-l command line option broken?

   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:innew’
/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:increate_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:increate_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:inload’
/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:ineach’
/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:inrun_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:inload’
/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:inregistration_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:inspec_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:inspec_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:inrun_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:inload’
/Users/Shared/RubyGems/1.8/bin/spec:19

On Oct 28, 2008, at 5:46 PM, Lenny M. wrote:

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.

I submitted a JRuby issue about this but it sounds like it might be
more of an rspec problem. See the issue comments.

Thanks,
-lenny

I submitted a JRuby issue about this but it sounds like it might be
more of an rspec problem. See the issue comments.

The link would probably help.

http://jira.codehaus.org/browse/JRUBY-3092

Sorry again for not replying directly to the messages on this thread
(been pasting from the archives) but I’m still not getting mail from
rspec-users. Is there something going on with that? If nobody else is
experiencing problems I’ll assume its on my side. Anyway, I just saw
David’s reply to check in lighthouse and I did find an open ticket. I
commented on it to link to all of this.

http://rspec.lighthouseapp.com/projects/5645/tickets/528-focused-
specs-not-working-when-using-jruby

Thanks,
-lenny