Forum: RSpec -l command line option broken?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lenny M. (Guest)
on 2008-10-29 00:31
(Received via mailing list)
>        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
Lenny M. (Guest)
on 2008-10-29 23:09
(Received via mailing list)
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
Lenny M. (Guest)
on 2008-10-30 05:39
(Received via mailing list)
>>
>> ...
>
>
> 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/ticke...
specs-not-working-when-using-jruby

Thanks,
-lenny
This topic is locked and can not be replied to.