sixarm_ruby_minitest_extensions 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f70dff4df7a5639e1d04072f8cb1f9b0b62d9ae3
4
- data.tar.gz: 42e23fe86ac61da795b1a95914ddab7c9f7c1ada
3
+ metadata.gz: 91d7c4b1a99615c9d811b17b6034304aab3f949d
4
+ data.tar.gz: 01922545ee4e3966b735f5ad6148c2f91e4c8e6e
5
5
  SHA512:
6
- metadata.gz: 28a68fa7c092b97c4eef2ddb483f63e6c0458fca146ff8bedc281cca2eca5b84efc742bf44582971c1fc5b36433e051ca8e290f36f4de9990b068584882f30bf
7
- data.tar.gz: e66f62700e31ff979f52110620d16c1a18b306812f1e991683d93d928da15cfe72610906918b5c35af18ede6dd25f5f1a0ac273742cdfaba5f43afca6b59d322
6
+ metadata.gz: 136b3f12d8ae429a26d54475f76f4cc7af9f6588edfdc41cfb5a47a15adb226d0478cadf4ce0a7f261059699a387f5a54064096bbfe0d6d32e58f3bd788a8798
7
+ data.tar.gz: 25b600717f3e48868370f9596ac4c6ab2e3b25e45ab4a6f6fd36d4f66ac8504aa142a3865acf25e7f2dbc84ee360d2262af9855268fb9462e3c96929fba8da6e
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -14,12 +14,14 @@ Assert:
14
14
  * assert_true
15
15
  * assert_false
16
16
  * assert_respond_to_all
17
+ * assert_equal_items
17
18
 
18
19
  Spec:
19
20
 
20
21
  * must_be_true
21
22
  * must_be_false
22
23
  * must_respond_to_all
24
+ * must_have_equal_items
23
25
 
24
26
  Based on Minitest.
25
27
 
@@ -36,7 +38,7 @@ Install:
36
38
 
37
39
  Bundler:
38
40
 
39
- gem "sixarm_ruby_minitest_extensions", "~>1.0.2"
41
+ gem "sixarm_ruby_minitest_extensions", "~>1.0.3"
40
42
 
41
43
  Require:
42
44
 
@@ -63,7 +65,7 @@ Example Minitest spec:
63
65
  describe Foo do
64
66
  it "validates" do
65
67
  f = Foo.new
66
- f.valid?.must_be_true
68
+ f.valid?.must_be_true
67
69
  end
68
70
  end
69
71
 
@@ -72,13 +74,14 @@ Example Minitest spec:
72
74
  describe Foo do
73
75
  it "is colorful" do
74
76
  f = Foo.new
75
- f.must_respond_to_all [:red, :green, :blue]
77
+ f.must_respond_to_all [:red, :green, :blue]
76
78
  end
77
79
  end
78
80
 
79
81
 
80
82
  ## Changes
81
83
 
84
+ * 2013-07-26 1.0.3 Add #assert_equal_items
82
85
  * 2013-06-04 1.0.2 Update to enable "Minitest" vs. "MiniTest"
83
86
  * 2013-06-03 1.0.1 Update for Minitest 5.x
84
87
  * 2013-06-02 1.0.0 Publish
@@ -6,21 +6,21 @@ Please see README
6
6
  module Minitest::Assertions
7
7
 
8
8
  ##
9
- # Fails unless +exp+ is true.
9
+ # Succeeds when +exp+ is true.
10
10
 
11
11
  def assert_true exp, msg = nil
12
12
  assert_same exp, true, msg
13
13
  end
14
14
 
15
15
  ##
16
- # Fails unless +exp+ is false.
16
+ # Succeeds when +exp+ is false.
17
17
 
18
18
  def assert_false exp, msg = nil
19
19
  assert_same exp, false, msg
20
20
  end
21
21
 
22
22
  ##
23
- # Fails unless +obj+ responds to each method in +meths+.
23
+ # Succeeds when +obj+ responds to each method in +meths+.
24
24
 
25
25
  def assert_respond_to_all obj, meths, msg = nil
26
26
  meths.each{|meth|
@@ -28,4 +28,14 @@ module Minitest::Assertions
28
28
  }
29
29
  end
30
30
 
31
+ ##
32
+ # Succeeds when +items_1+ and +items_2+ have all equal items,
33
+ # regardless of ordering of the items.
34
+
35
+ def assert_equal_items items_1, items_2, msg = nil
36
+ hashes_1 = items_1.map{|item| item.hash}.sort
37
+ hashes_2 = items_2.map{|item| item.hash}.sort
38
+ assert_equal hashes_1, hashes_2, msg
39
+ end
40
+
31
41
  end
@@ -7,5 +7,6 @@ module Minitest::Expectations
7
7
  Object.infect_an_assertion :assert_true, :must_be_true, :reverse
8
8
  Object.infect_an_assertion :assert_false, :must_be_false, :reverse
9
9
  Object.infect_an_assertion :assert_respond_to_all, :must_respond_to_all, :reverse
10
+ Object.infect_an_assertion :assert_equal_items, :must_have_equal_items, :reverse
10
11
  end
11
12
 
@@ -50,6 +50,24 @@ describe "Minitest" do
50
50
 
51
51
  end
52
52
 
53
+ describe "#assert_equal_items" do
54
+
55
+ describe "smoke test with some items" do
56
+
57
+ it "works" do
58
+ assert_equal_items([:a, :b], [:b, :a])
59
+ end
60
+
61
+ it "fails" do
62
+ proc {
63
+ assert_equal_items([:a, :b], [:a, :z])
64
+ }.must_raise MiniTest::Assertion
65
+ end
66
+
67
+ end
68
+
69
+ end
70
+
53
71
  end
54
72
 
55
73
  end
@@ -50,6 +50,24 @@ describe "Minitest" do
50
50
 
51
51
  end
52
52
 
53
+ describe "#must_have_equal_items" do
54
+
55
+ describe "smoke test with some items" do
56
+
57
+ it "works" do
58
+ [:a, :b].must_have_equal_items [:b, :a]
59
+ end
60
+
61
+ it "fails" do
62
+ proc {
63
+ [:a, :b].must_have_equal_items [:a, :z]
64
+ }.must_raise MiniTest::Assertion
65
+ end
66
+
67
+ end
68
+
69
+ end
70
+
53
71
  end
54
72
 
55
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarm_ruby_minitest_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SixArm
@@ -28,7 +28,7 @@ cert_chain:
28
28
  ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
29
29
  eabwpCbAopo=
30
30
  -----END CERTIFICATE-----
31
- date: 2013-06-04 00:00:00.000000000 Z
31
+ date: 2013-07-27 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: minitest
metadata.gz.sig CHANGED
Binary file