jRuby and RSpec shared examples issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "weird" do |options={}| | |
# Uncomment to make it work in jruby | |
#options = {} unless options.respond_to? :to_hash | |
it "should be a hash" do | |
options.should be_a Hash | |
end | |
end | |
describe "shared example issue" do | |
it_behaves_like "weird", {} | |
it_behaves_like "weird" # here, the options is an RSpec example class | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> rvm use 1.9.3 && rspec sample_spec.rb | |
Using /Users/dnagir/.rvm/gems/ruby-1.9.3-p0 | |
.. | |
Finished in 0.3487 seconds | |
2 examples, 0 failures | |
> echo $JRUBY_OPTS | |
--1.9 | |
> rvm use jruby && rspec sample_spec.rb | |
Using /Users/dnagir/.rvm/gems/jruby-1.6.5 | |
.F | |
Failures: | |
1) shared example issue behaves like weird should be a hash | |
Failure/Error: options.should be_a Hash | |
expected #<Class:0x728edb84>::Nested_2 to be a kind of Hash | |
Shared Example Group: "weird" called from ./sample_spec.rb:14 | |
# ./sample_spec.rb:7:in `(root)' | |
Finished in 0.843 seconds | |
2 examples, 1 failure | |
Failed examples: | |
rspec ./sample_spec.rb:6 # shared example issue behaves like weird should be a hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment