Skip to content

Commit

Permalink
No silent rescue in Comparable#<=> is now released behavior in 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jan 3, 2016
1 parent 9a20b87 commit f59a862
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions core/comparable/equal_value_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

no_silent_rescue = "2.3"

describe "Comparable#==" do
a = b = nil
before :each do
Expand Down Expand Up @@ -50,13 +48,13 @@
a.should_receive(:<=>).once.and_return("abc")
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "raises an ArgumentError" do
lambda { (a == b) }.should raise_error(ArgumentError)
end
Expand All @@ -69,14 +67,14 @@
a.should_receive(:<=>).once.and_raise(StandardError)
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
# Behaviour confirmed by MRI test suite
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "lets it go through" do
lambda { (a == b) }.should raise_error(StandardError)
end
Expand All @@ -89,13 +87,13 @@
a.should_receive(:<=>).once.and_raise(TypeError)
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "lets it go through" do
lambda { (a == b) }.should raise_error(TypeError)
end
Expand Down

0 comments on commit f59a862

Please sign in to comment.