Conversation
|
|
||
| @rspec_runner.reset | ||
| task_file_ext = File.extname(task.spec_file) | ||
| runner = RunnerFactory.create(task_file_ext) |
There was a problem hiding this comment.
BUG: RSpecRunner has a before_suite_run flag for oneshot suite-wide initialization. New-ing the runner for each task resets this flag and causes multiple initialization.
There was a problem hiding this comment.
I've made a chain of runner factories, to allow plugin the runners.
The RSpecRunnerFactory has the runner as a singleton, that way the bug is gone. I've also added a spec to avoid this bug in the future.
486e67c to
f879a1f
Compare
| module RRRSpec | ||
| module Client | ||
| class RSpecRunnerFactory | ||
| attr_reader :next_factory |
There was a problem hiding this comment.
If the factory implementation can be switched by the file extension, isn't it better to have a registry type plugin structure instead of chaining?
There was a problem hiding this comment.
A registry would be a nice solution, but it would limit how the choice of the runner is made.
Currently the choice is made in the plugin, if we change it to a registry, the choice would be made be rrrspec and not in the plugin.
My doubt is if we can find a general rule that works for all future cases so that the choice can be made in rrrspec code and not in the plugin.
There was a problem hiding this comment.
I think it's really hard to find a "general rule" based on a file extension. It's just a few characters. If there's no usage for that flexibility right now, it's better to keep it simple. Chaining is a good solution if the argument needs to be decorated (e.g. Java's Servlet API), but in this case it seems no use to me. If you should need more flexibility, it's better to let users to specify the factory directly and let them write in a composition style, instead of forcing chaining.
There was a problem hiding this comment.
Added a registry for runner factories
2f19e5f to
d45f697
Compare
d45f697 to
90359c3
Compare
rrrspec-client/lib/rrrspec.rb
Outdated
| require 'rrrspec/client/rspec_runner_factory' | ||
|
|
||
| module RRRSpec | ||
| Registry.register_runner_factory RRRSpec::Client::RSpecRunnerFactory.new |
There was a problem hiding this comment.
Please move this to rspec_runner_factory.rb
d3b026e to
2af227d
Compare
* cucumber plugin @ https://github.com/Seedrs/rrrspec-cucumber
2af227d to
86fdb49
Compare
This runs cucumber tests mixed with rspec tests.
To add the cucumber plugin add rrrspec-cucumber to your gemfile
Then in .rrrspec configure the runner chain to include rrrspec-cucumber
You can checkout the plugin code at https://github.com/Seedrs/rrrspec-cucumber
For the slave to load the .rrrspec configuration the slave command also has to be changed
Finally, add cucumber to a rails project and in .rrrspec also select the .features