Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Test failure on JRuby 1.6.0 #44

Closed
kaiwren opened this Issue · 3 comments

3 participants

@kaiwren

Running rake for rspec-mocks against Jruby-1.6.0 on OSX against ef127a5 has nil_expectation_warning_spec.rb fail with the trace given at the end of this ticket.

The failure seems to be occurring because jruby returns a failure trace with
Called from #{FILE}:#{LINE+3}:in (class Mocks)'
instead of what CRuby returns which is
Called from #{__FILE__}:#{__LINE__+3}(:in
block (2 levels) in module:Mocks

These strings are generated by caller[4] so this might actually be a JRuby issue (which I will check and confirm).

Trace:
1) an expectation set on nil issues a warning with file and line number information
Failure/Error: nil.should_receive(:foo)
Kernel received :warn with unexpected arguments
expected: (/An expectation of :foo was set on nil. Called from \/Users\/sidu\/Work\/Rspec\/rspec-mocks\/spec\/rspec\/mocks\/nil_expectation_warning_spec.rb:21(:in block \(2 levels\) in <module:Mocks>')?. Use allow_message_expectations_on_nil to disable warnings./)
got: ("An expectation of :foo was set on nil. Called from /Users/sidu/Work/Rspec/rspec-mocks/spec/rspec/mocks/nil_expectation_warning_spec.rb:21:in
(class Mocks)'. Use allow_message_expectations_on_nil to disable warnings.")
# ./spec/rspec/mocks/nil_expectation_warning_spec.rb:21:in (class Mocks)'
# org/jruby/RubyKernel.java:2007:in
instance_eval'
# org/jruby/RubyArray.java:2306:in collect'
# org/jruby/RubyArray.java:2306:in
collect'

@headius

This is going too far. The format of caller lines is going to differ across Ruby impls and potentially even across Ruby versions. If RSpec is looking for that exact format of line, I believe it is asking too much.

Where's the code that wants caller lines formatted this way?

@kaiwren

Submitted pull-request. See #45.

@kaiwren

Not so dependent on a particular ruby implementation. Closed by 8e2c1a2 Closed by 8e2c1a2

@justinko justinko closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.