[rspec-users] -l command line option broken?

Lenny Marks lenny at aps.org
Tue Oct 28 17:46:38 EDT 2008


> Sorry for not replying to the thread but I'm not getting any mail from
> rspec-users right now for whatever reason.
>
> It looks like it is an issue specific to jruby.
>
> With rspec-1.1.11 and jruby-1.4
>
> #linenumber_spec.rb
> describe "line number" do
>     it "should be example one" do
>        true.should be_true
>     end
>     it "should be another example" do
>        true.should be_true
>     end
> end

I'm not familiar enough with the rspec code to get to the bottom of  
this, but I did enough drilling to find its related to the new  
backtrace based strategy for  
Spec::Runner::SpecParser#spec_name_for(file, line_number).  Putting a  
print statement inside  
Spec::Example::ExampleGroupMethods#registration_backtrace I get the  
following which shows that the target spec file isn't even in the  
backtrace from jruby.

def registration_backtrace
          backtrace = eval("caller", @registration_binding_block)

          puts "backtrace: #{backtrace.join("\n")}"

          backtrace
       end

 > ruby $GEM_HOME/bin/spec -l 2 $HOME/tmp/linenumber_spec.rb
backtrace: /Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/ 
example/example_group_methods.rb:27:in `initialize'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/extensions/ 
class.rb:9:in `new'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/extensions/ 
class.rb:9:in `subclass'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/example/ 
example_group_methods.rb:66:in `create_nested_example_group'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/example/ 
example_group_methods.rb:53:in `describe'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/example/ 
example_group_factory.rb:53:in `create_example_group'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/extensions/ 
main.rb:27:in `describe'
/home/jis/compsvc/lenny/tmp/linenumber_spec.rb:1
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
example_group_runner.rb:14:in `load'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
example_group_runner.rb:14:in `load_files'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
example_group_runner.rb:13:in `each'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
example_group_runner.rb:13:in `load_files'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
options.rb:98:in `run_examples'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
command_line.rb:10:in `run'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/bin/spec:4
/Users/Shared/RubyGems/1.8/bin/spec:19:in `load'
/Users/Shared/RubyGems/1.8/bin/spec:19



 > jruby-1.1.4/bin/jruby $GEM_HOME/bin/spec -l 2 $HOME/tmp/ 
linenumber_spec.rb
backtrace: /Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/ 
extensions/class.rb:9:in `eval'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/example/ 
example_group_methods.rb:203:in `registration_backtrace'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
spec_parser.rb:35:in `consider_example_groups_for_best_match'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
spec_parser.rb:15:in `spec_name_for'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
spec_parser.rb:14:in `each'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
spec_parser.rb:14:in `spec_name_for'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
options.rb:302:in `set_spec_from_line_number'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
options.rb:114:in `run_examples'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/lib/spec/runner/ 
command_line.rb:10:in `run'
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/bin/spec:4
/Users/Shared/RubyGems/1.8/gems/rspec-1.1.11/bin/spec:19:in `load'
/Users/Shared/RubyGems/1.8/bin/spec:19





More information about the rspec-users mailing list