On Sunday, January 24, 2016 at 3:36:22 PM UTC-8, Jon Rowe wrote: > > Hi Robb > > What 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. > > Thanks for the feedback. I'm now using the public API, although this is probably incorrect, and less than efficient.
I'm generating RSpec on the fly in string form, executing it, and then using the results. This is a web app compliance monitoring service, Nonstop QA <http://nonstop.qa>. # The strategy I'm using in http://nonstop.qa. This has # a messy feel, and I'm rethinking it. It's also possible # I'm not sure I'm using the RSpec API correctly or as # efficiently as possible. # I first prepare RSpec's output. def prepare_rspec output = StringIO.new('', 'w') RSpec.configure do |rspec| rspec.default_formatter = 'json' rspec.output_stream = output end output end # Then, I invoke this with each spec I need to run, # which is in string form. def run_spec(source_code, output) file = create_temp_file(source_code) RSpec::Core::Runner.run([file.path]) json_string = output.string output.reopen('', 'w') file.unlink JSON.parse(json_string) end -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/3a452a6e-5711-4c98-a92b-4e88780a04ba%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
