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

ruby-changes:10158

From: ryan <ko1@a...>
Date: Wed, 21 Jan 2009 08:27:19 +0900 (JST)
Subject: [ruby-changes:10158] Ruby:r21701 (trunk): Imported minitest 1.3.1 r4532.

ryan	2009-01-21 08:26:55 +0900 (Wed, 21 Jan 2009)

  New Revision: 21701

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21701

  Log:
    Imported minitest 1.3.1 r4532.

  Modified files:
    trunk/ChangeLog
    trunk/lib/minitest/unit.rb
    trunk/test/minitest/test_mini_spec.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21700)
+++ ChangeLog	(revision 21701)
@@ -1,3 +1,8 @@
+Wed Jan 21 08:22:04 2009  Ryan Davis  <ryand-ruby@z...>
+
+	* lib/minitest/*.rb: Imported minitest 1.3.1 r4532.
+	* test/minitest/*.rb: ditto.
+
 Tue Jan 20 20:16:21 2009  Tanaka Akira  <akr@f...>
 
 	* ext/socket/socket.c (socket_s_list_ip_address): new method.
Index: lib/minitest/unit.rb
===================================================================
--- lib/minitest/unit.rb	(revision 21700)
+++ lib/minitest/unit.rb	(revision 21701)
@@ -96,6 +96,8 @@
 
     def assert_includes collection, obj, msg = nil
       msg = message(msg) { "Expected #{mu_pp(collection)} to include #{mu_pp(obj)}" }
+      flip = (obj.respond_to? :include?) && ! (collection.respond_to? :include?) # HACK for specs
+      obj, collection = collection, obj if flip
       assert_respond_to collection, :include?
       assert collection.include?(obj), msg
     end
@@ -261,6 +263,8 @@
 
     def refute_includes collection, obj, msg = nil
       msg = message(msg) { "Expected #{mu_pp(collection)} to not include #{mu_pp(obj)}" }
+      flip = (obj.respond_to? :include?) && ! (collection.respond_to? :include?) # HACK for specs
+      obj, collection = collection, obj if flip
       assert_respond_to collection, :include?
       refute collection.include?(obj), msg
     end
Index: test/minitest/test_mini_spec.rb
===================================================================
--- test/minitest/test_mini_spec.rb	(revision 21700)
+++ test/minitest/test_mini_spec.rb	(revision 21701)
@@ -154,4 +154,16 @@
     1.wont_be_same_as(2).must_equal false
     proc { 1.wont_be_same_as 1 }.must_raise MiniTest::Assertion
   end
+
+  it "needs to be sensible about must_include order" do
+    @assertion_count = 6
+    [1, 2, 3].must_include(2).must_equal true
+    proc { [1, 2, 3].must_include 5 }.must_raise MiniTest::Assertion
+  end
+
+  it "needs to be sensible about wont_include order" do
+    @assertion_count = 6
+    [1, 2, 3].wont_include(5).must_equal false
+    proc { [1, 2, 3].wont_include 2 }.must_raise MiniTest::Assertion
+  end
 end

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

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