config = RSpec.configuration
json_formatter = RSpec::Core::Formatters::JsonFormatter.new(config.out)
reporter = RSpec::Core::Reporter.new(json_formatter)
config.instance_variable_set(:@reporter, reporter)
RSpec::Core::Runner.run(["#{Rails.root}/spec/test1_spec.rb"])
puts json_formatter.output_hash
# internal hack
# api may not be stable, make sure lock down Rspec version
loader = config.send(:formatter_loader)
notifications = loader.send(:notifications_for, RSpec::Core::Formatters::JsonFormatter)
reporter.register_listener(formatter, *notifications)
I'm not sure what that's about.To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAK-y3CtoNJUDvrJ8A_yPR4nZx0gvLS%3DHVXgXkHt0Dq6MpXv%3D%3DA%40mail.gmail.com.
Hi RobbWhat are you trying to achieve with this? I might be able to find you a way to do this without using private APIs / interfering with the RSpec internals.
On Saturday, 13 February 2016 at 19:45, Robb Shecter wrote:
It looks pretty clear that I'm doing too much work, and not using the inputs and outputs efficiently. I'm thinking of switching to simply shelling out, and reading the json formatter's stdout.
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/da1852df-63fc-45af-8a03-e78e79ecb751%40googlegroups.com.
...if you’re creating the specs inside Ruby have you considered creating them programatically rather than writing them to files?
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/fe3e8f22-0763-48dc-87e8-9edf11829507%40googlegroups.com.