Fixing the build on JRuby 1.6.0 - this brings it down to 2 failures #341

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
3 participants
@kaiwren
Contributor

kaiwren commented Mar 23, 2011

I've chosen to mark doesn't hang when file exists in base_formatter_spec.rb pending rather than filter it with :ruby => "!jruby" because it isn't something that will never work on JRuby. Once http://jira.codehaus.org/browse/JRUBY-5634 makes it into a release we should be able to remove that pending directive.

@@ -46,6 +46,7 @@ describe RSpec::Core::Formatters::BaseFormatter do
end
it "doesn't hang when file exists" do
+ pending("This issue still exists on JRuby, but should be resolved shortly: https://github.com/rspec/rspec-core/issues/295") if RUBY_ENGINE == 'jruby'

This comment has been minimized.

Show comment Hide comment
@myronmarston

myronmarston Mar 23, 2011

Owner

You might consider using the block form of pending with an :if option. This is exactly the use case for that feature. See the last scenario for this cuke.

@myronmarston

myronmarston Mar 23, 2011

Owner

You might consider using the block form of pending with an :if option. This is exactly the use case for that feature. See the last scenario for this cuke.

This comment has been minimized.

Show comment Hide comment
@kaiwren

kaiwren Mar 23, 2011

Contributor
@myronmarston

This comment has been minimized.

Show comment Hide comment
@myronmarston

myronmarston Mar 23, 2011

Thanks. Actually, you need to use the block form to get the benefit of this. It'd be like this:

it "doesn't hang when file exists" do
  pending("This issue still exists on JRuby, but should be resolved shortly: https://github.com/rspec/rspec-core/issues/295", :if => RUBY_ENGINE == 'jruby') do
    exception = mock(:Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"])

    example = mock(:Example, :file_path => __FILE__)
    formatter.send(:read_failed_line, exception, example).should
      eql %Q{        exception = mock(:Exception, :backtrace => [ "\#{__FILE__}:\#{__LINE__}"])\n}
  end
end

The benefit is that the block is still always executed. On JRuby, if the block fails, it will be considered pending, with the message you have given. If it passes, then the spec will fail with a message like expected pending example to fail, but passed. On non-JRuby platforms, it will just run the spec like normal.

Thanks. Actually, you need to use the block form to get the benefit of this. It'd be like this:

it "doesn't hang when file exists" do
  pending("This issue still exists on JRuby, but should be resolved shortly: https://github.com/rspec/rspec-core/issues/295", :if => RUBY_ENGINE == 'jruby') do
    exception = mock(:Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"])

    example = mock(:Example, :file_path => __FILE__)
    formatter.send(:read_failed_line, exception, example).should
      eql %Q{        exception = mock(:Exception, :backtrace => [ "\#{__FILE__}:\#{__LINE__}"])\n}
  end
end

The benefit is that the block is still always executed. On JRuby, if the block fails, it will be considered pending, with the message you have given. If it passes, then the spec will fail with a message like expected pending example to fail, but passed. On non-JRuby platforms, it will just run the spec like normal.

This comment has been minimized.

Show comment Hide comment
@kaiwren

kaiwren Mar 24, 2011

Owner

Aye, but the problem is that executing this block on JRuby does not result in a failure; instead, it causes the process to hang and the build never finishes.

Owner

kaiwren replied Mar 24, 2011

Aye, but the problem is that executing this block on JRuby does not result in a failure; instead, it causes the process to hang and the build never finishes.

This comment has been minimized.

Show comment Hide comment
@myronmarston

myronmarston Mar 24, 2011

That makes sense. Sorry, I didn't realize it was hanging.

That makes sense. Sorry, I didn't realize it was hanging.

@kaiwren

This comment has been minimized.

Show comment Hide comment
@kaiwren

kaiwren Mar 24, 2011

Contributor

Get build to pass on jruby.

Contributor

kaiwren commented Mar 24, 2011

Get build to pass on jruby.

@dchelimsky dchelimsky closed this Mar 24, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment