Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException thrown when a method is defined inside a test #4014

Closed
JasonLunn opened this issue Jul 13, 2016 · 0 comments
Closed

ClassCastException thrown when a method is defined inside a test #4014

JasonLunn opened this issue Jul 13, 2016 · 0 comments
Labels
Milestone

Comments

@JasonLunn
Copy link
Contributor

Environment

jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 24.45-b08 on 1.7.0_45-b18 +jit [darwin-x86_64]
Darwin shinji.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

First discovered in the body of a large Rails 4.2.6 application where I am piloting the transition to JRuby 9K, but reproduced in a stock Rails application fresh out of the scaffold.

Other relevant info you may wish to add:

  • Rails 4.2.7

Expected Behavior

  • Defining a function in the body of a test should not cause a ClassCastException to be raised at runtime. It worked fine under JRuby 1.7.x.
require 'test_helper'

class FailcaseTest < ActiveSupport::TestCase
  test 'should not throw a class cast exception' do
    def bad
    end
  end
end

Actual Behavior

bundle exec rake test
Run options: --seed 7502

# Running:

E

Finished in 0.028675s, 34.8738 runs/s, 0.0000 assertions/s.

  1) Error:
FailcaseTest#test_should_not_throw_a_class_cast_exception:
Java::JavaLang::ClassCastException: org.jruby.RubyObjectVar7 cannot be cast to org.jruby.RubyModule


1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
@enebo enebo added the ir label Jul 14, 2016
@enebo enebo added this to the JRuby 9.1.3.0 milestone Jul 14, 2016
subbuss added a commit that referenced this issue Jul 26, 2016
* Jason Lunn provided the reduced test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants