[前][次][番号順一覧][スレッド一覧]

ruby-changes:46720

From: stomar <ko1@a...>
Date: Mon, 22 May 2017 04:25:25 +0900 (JST)
Subject: [ruby-changes:46720] stomar:r58835 (trunk): Use should_receive expectation instead of singleton method

stomar	2017-05-22 04:25:19 +0900 (Mon, 22 May 2017)

  New Revision: 58835

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58835

  Log:
    Use should_receive expectation instead of singleton method

  Modified files:
    trunk/spec/rubyspec/core/string/casecmp_spec.rb
Index: spec/rubyspec/core/string/casecmp_spec.rb
===================================================================
--- spec/rubyspec/core/string/casecmp_spec.rb	(revision 58834)
+++ spec/rubyspec/core/string/casecmp_spec.rb	(revision 58835)
@@ -19,8 +19,9 @@ describe "String#casecmp independent of https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/string/casecmp_spec.rb#L19
   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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]