Community
Participate
Working Groups
Build ID: M20090211-1700 Steps To Reproduce: 1. Install latest RSpec 1.2.0 (http://rspec.info/) 2. Create a spec 3. Run the spec Result: /home/tobias/opt/eclipse/configuration/org.eclipse.osgi/bundles/393/1/.cp/testing/dltk-rspec-runner.rb:364: uninitialized constant Spec::Extensions (NameError) More information:
Just a small update: RSpec 1.1.12 and 1.2.0 have a small issue, which breaks the way RSpec is used by the DLTK, This will be fixed in 1.2.1 over the weekend (see [1]). I've already tested it and with a slighlty modified dltk-rspec-runner.rb it works fine with versions 1.1.3 - 1.1.11 and 1.2.1. I'll post a patch as soon as the final 1.2.1 of RSpec is released. [1]: http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/738-regression-in-specexampleexamplemethodsexecute-behavior-in-rspec-120#ticket-738-23
Created attachment 129782 [details] dltk-rspec-runner.rb fix for RSpec 1.2.2 Ok, RSpec 1.2.2 has been released now, and I've attached a patch for dltk-rspec-runner.rb It works for versions 1.1.3 - 1.1.11 and 1.2.1 - 1.2.2 of RSpec. (RSpec 1.1.12 and 1.2.0 are broken!) The patch is as least intrusive as possible, but I would suggest to drop support for RSpec < 1.2.2 in favor of a complete refactoring of dltk-rspec-runner.rb. If this would be ok, let me know I would be volunteering for it.
Hi Tobias, Thank you for the patch. I will check it and apply after that. The only question I have is related to the examples_to_run method. It was used if the rspec was started with a filter, e.g. during 'Rerun failed tests' action. Ideally we should also have the check for version == 1.2.0 and stop execution since this particular version does not work. Regards, Alex
Version 1.2.2 was released only 7 days after 1.2.0. It's highly unlikely anyone will use this version. But checking the version doesn't hurt. It's only a one-liner: raise "RSpec 1.2.0 is not supported, please update RSpec" if ::Spec::VERSION::STRING == '1.2.0' As for your question about examples_to_run: RSpec now only passes ExampleProxy and ExampleGroupProxy to the formatters, where no examples_to_run is available. ExampleGroupProxy will only provide a list of all examples from the group, not just the ones that would be run. The cleanest solution might be to modify RSpec itself. Another way to do this would be to do --dry-run to build the example tree in a first run and then run the examples in a second run. The easiest way would be to move the creation of the test nodes to example_started(). But this doesn't work, because I don't know the number of tests in a group, when creating the group node. What do you think? Shall I try the --dry-run approach or shall I provide a patch for RSpec and wewait for 1.2.3? Another solution might be to change the Java part to simply hide tests that were not run when doing a 'Rerun failed tests'. Tobias
PS: I think with a small amount of monkey patching, ExampleGroupProxy can be extended to provide the filtered list of examples. This can then be pushed upstream. Might be the best solution, I'll try it this way and provide a patch.
My suggestion is to modify RSpec. It would make their API more complete, ExampleGroupProxy would have different methods to return all tests and the tests which are to be executed.
Created attachment 130160 [details] Fixes for RSpec >= 1.1.12 Adding an examples_to_run to the ExampleGroupProxy doesn't really fit into RSpec. I solved this issue by pulling the filtering of examples into the formatter. This is backwards compatible and doesn't require any nasty RSpec hacks or monkey patching Here's a new patch. I've tested it with all released versions from 1.1.4 (the oldest available in the RSpec Git) up to 1.2.2. Only 1.2.0 doesn't work, but this release became only 7 days old, before 1.2.1 was released. The "run all examples" as well as the "run failed examples" now works fine. There's just one minor issue: For nested descriptions, DLTK is unable to jump from the example group to the source code. But this is no regression - it never worked for nested descriptions and therefore I suggest to ignore this for now and fix it later. I'll open a new bug for this, as soon as this one is closed.
Created attachment 132346 [details] RSpec runner bugfixes for RSpec up to 1.2.4 I've updated the patch for RSpec 1.2.2.1, 1.2.3 and 1.2.4
Committed to HEAD, will be included in DLTK 1.0 M7 release