guard-jruby-rspec icon indicating copy to clipboard operation
guard-jruby-rspec copied to clipboard

Shared Examples

Open garrettheaver opened this issue 13 years ago • 3 comments
trafficstars

Whilst it seems to load the shared examples fine on the first pass, subsequent runs it completely loses track of for some reason and throws a big exception stack ala :

stty: stdin isn't a terminal stty: stdin isn't a terminal stty: stdin isn't a terminal stty: stdin isn't a terminal stty: stdin isn't a terminal ... ERROR: Guard::JRubyRSpec failed to achieve its <run_on_changes>, exception was: ArgumentError: Could not find shared examples "a store" /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:123:in find_and_eval_shared' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:93:init_behaves_like' org/jruby/RubyModule.java:2277:in module_eval' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:201:insubclass' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:186:in describe' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:92:init_behaves_like' ... org/jruby/RubyModule.java:2277:in module_eval' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:201:insubclass' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:186:in describe' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/dsl.rb:18:indescribe' ... org/jruby/RubyKernel.java:1068:in load' ... org/jruby/RubyArray.java:2339:incollect' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746:in load_spec_files' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22:inrun' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in run' /Users/garrett/.rvm/gems/jruby-1.6.7/bundler/gems/guard-jruby-rspec-0077eb119b88/lib/guard/jruby-rspec/runner.rb:46:inrun' /Users/garrett/.rvm/gems/jruby-1.6.7/gems/guard-rspec-1.0.1/lib/guard/rspec.rb:49:in run_on_changes' org/jruby/RubyBasicObject.java:1704:insend' org/jruby/RubyKernel.java:2101:in `send'

garrettheaver avatar Jun 27 '12 18:06 garrettheaver

I'm not sure about the error, yet. But the stty: stdin isn't a terminal can be fixed by adding this to your Guardfile

interactor :simple

The default interactor doesn't play will with JRuby.

jkutner avatar Jun 28 '12 15:06 jkutner

thanks for the heads up on that one. I'd really love to get guard working at some acceptable pace on jruby though, it's pathetically slow running rspec-guard which appears to spin off about 4 separate processes each of which takes the order of 10 seconds of cpu time to complete on each run. I've had to stop using guard on jruby altogether and just manually run rspec intermittently

garrettheaver avatar Jun 28 '12 22:06 garrettheaver

Just following up here with some more information as I dig. In my case it was failing as it couldn't find the shared examples in the second run. I looked through the jruby-rspec source and see you're using load p to reload the file under test which makes total sense.

In my case however that file it's (re)loading has a require to pull in the shared examples from another file and this presumably wasn't being executed (so the shared group no longer existed in the context of the new load I surmise). I've changed it from require shared_examples to load shared_examples.rb and the problem is solved. It's a curious issue.

garrettheaver avatar Jun 30 '12 15:06 garrettheaver