From 47f2bd93347b3acc04cbb2cd44ca25e87c0d0ab5 Mon Sep 17 00:00:00 2001 From: stomar Date: Sun, 21 May 2017 19:25:19 +0000 Subject: Use should_receive expectation instead of singleton method git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/rubyspec/core/string/casecmp_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/rubyspec/core/string/casecmp_spec.rb b/spec/rubyspec/core/string/casecmp_spec.rb index c5503a18bf..6bfb66e039 100644 --- a/spec/rubyspec/core/string/casecmp_spec.rb +++ b/spec/rubyspec/core/string/casecmp_spec.rb @@ -19,8 +19,9 @@ describe "String#casecmp independent of case" do end it "tries to convert other to string using to_str" do - other = mock('abc') - def other.to_str() "abc" end + other = mock('x') + other.should_receive(:to_str).and_return("abc") + "abc".casecmp(other).should == 0 end -- cgit v1.2.3