diff options
| author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-20 23:26:55 +0000 |
|---|---|---|
| committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-20 23:26:55 +0000 |
| commit | d42f5c7ca2b0cd71891b6b43de880fe83e807311 (patch) | |
| tree | 91f93fc4b04cbb9dfc1a5555d6adb5043e00165c | |
| parent | fcc15762f1a6642d687d4d406164f597447b4e47 (diff) | |
| download | ruby-d42f5c7ca2b0cd71891b6b43de880fe83e807311.tar.gz ruby-d42f5c7ca2b0cd71891b6b43de880fe83e807311.tar.xz ruby-d42f5c7ca2b0cd71891b6b43de880fe83e807311.zip | |
Imported minitest 1.3.1 r4532.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/minitest/unit.rb | 4 | ||||
| -rw-r--r-- | test/minitest/test_mini_spec.rb | 12 |
3 files changed, 21 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Wed Jan 21 08:22:04 2009 Ryan Davis <ryand-ruby@zenspider.com> + + * lib/minitest/*.rb: Imported minitest 1.3.1 r4532. + * test/minitest/*.rb: ditto. + Tue Jan 20 20:16:21 2009 Tanaka Akira <akr@fsij.org> * ext/socket/socket.c (socket_s_list_ip_address): new method. diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index 0f71126b0..df7d6f5d4 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -96,6 +96,8 @@ module MiniTest 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 @@ module MiniTest 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 diff --git a/test/minitest/test_mini_spec.rb b/test/minitest/test_mini_spec.rb index f7cd60acd..89c552308 100644 --- a/test/minitest/test_mini_spec.rb +++ b/test/minitest/test_mini_spec.rb @@ -154,4 +154,16 @@ describe MiniTest::Spec do 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 |
