Skip to content

Instantly share code, notes, and snippets.

@vvs
Created January 20, 2010 20:19
Show Gist options
  • Select an option

  • Save vvs/282205 to your computer and use it in GitHub Desktop.

Select an option

Save vvs/282205 to your computer and use it in GitHub Desktop.
diff --git a/core/array/equal_value_spec.rb b/core/array/equal_value_spec.rb
index c579146..069d2ef 100644
--- a/core/array/equal_value_spec.rb
+++ b/core/array/equal_value_spec.rb
@@ -5,6 +5,13 @@ require File.dirname(__FILE__) + '/shared/eql'
describe "Array#==" do
it_behaves_like :array_eql, :==
+ it 'compares with an equivalent Array-like object using #to_ary' do
+ obj = mock('array-like')
+ obj.should_receive(:respond_to?).with(:to_ary).and_return(true)
+ obj.should_receive(:==).with([1]).and_return(true)
+ ([[1]] == [obj]).should be_true
+ end
+
it "returns false if any corresponding elements are not #==" do
a = ["a", "b", "c"]
b = ["a", "b", "not equal value"]
D:\work\jruby-dev\rubyspec.git>jruby -S mspec core\array\equal_value_spec.rb core\array | more
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-20 85ee044) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.EEEEE.EEEEE.EEEEE
1)
An exception occurred during: Mock.cleanup
Array#== compares with an equivalent Array-like object using #to_ary ERROR
NoMethodError: undefined method `__mspec_27253707_respond_to?__' for #<MockObject:0x19fdbcb>
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:55:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-run:8
2)
An exception occurred during: Mock.cleanup
Array#== returns false if any corresponding elements are not #== ERROR
NoMethodError: undefined method `__mspec_27253707_respond_to?__' for #<MockObject:0x19fdbcb>
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:55:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-run:8
3)
An exception occurred during: Mock.cleanup
Array#== returns true if corresponding elements are #== ERROR
NoMethodError: undefined method `__mspec_27253707_respond_to?__' for #<MockObject:0x19fdbcb>
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:55:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-run:8
4)
An exception occurred during: Mock.cleanup
Array#== returns false for [NaN] == [NaN] ERROR
NoMethodError: undefined method `__mspec_27253707_respond_to?__' for #<MockObject:0x19fdbcb>
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:5
D:/work/jruby-dev/rubyspec.git/core/array/equal_value_spec.rb:55:in `load'
D:/work/jruby-dev/mspec.git/bin/mspec-run:8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment