sixarm_ruby_minitest_extensions 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91d7c4b1a99615c9d811b17b6034304aab3f949d
4
- data.tar.gz: 01922545ee4e3966b735f5ad6148c2f91e4c8e6e
3
+ metadata.gz: 0febece1571a1175e4e0332f33cee7dddb35b114
4
+ data.tar.gz: 07600419a25889feb061a2a3329911b08917b2b6
5
5
  SHA512:
6
- metadata.gz: 136b3f12d8ae429a26d54475f76f4cc7af9f6588edfdc41cfb5a47a15adb226d0478cadf4ce0a7f261059699a387f5a54064096bbfe0d6d32e58f3bd788a8798
7
- data.tar.gz: 25b600717f3e48868370f9596ac4c6ab2e3b25e45ab4a6f6fd36d4f66ac8504aa142a3865acf25e7f2dbc84ee360d2262af9855268fb9462e3c96929fba8da6e
6
+ metadata.gz: 6d83459285c0987c2839525bcb280d53a838e68f196e0f363d18f9b5e1d6f86cf88a882ef2b66dca40fdf30d519bd9726149af6d108f44d5bdd8b0b0f23bf4bd
7
+ data.tar.gz: bb22261408def1f885be2794f044e3ed5821f84d1705651a7eb43eae477a00f9d431a3d15789071dfb5760b6b1fa3b56f1e6227583ca9997b822af3f61188d88
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -81,7 +81,8 @@ Example Minitest spec:
81
81
 
82
82
  ## Changes
83
83
 
84
- * 2013-07-26 1.0.3 Add #assert_equal_items
84
+ * 2013-07-27 1.0.4 Add #assert_exist and #must_exist
85
+ * 2013-07-26 1.0.3 Add #assert_equal_items and #must_have_equal_items
85
86
  * 2013-06-04 1.0.2 Update to enable "Minitest" vs. "MiniTest"
86
87
  * 2013-06-03 1.0.1 Update for Minitest 5.x
87
88
  * 2013-06-02 1.0.0 Publish
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.4
@@ -19,6 +19,13 @@ module Minitest::Assertions
19
19
  assert_same exp, false, msg
20
20
  end
21
21
 
22
+ ##
23
+ # Succeeds when +obj+ exists, i.e. is not nil.
24
+
25
+ def assert_exist obj, msg
26
+ refute_nil obj, msg
27
+ end
28
+
22
29
  ##
23
30
  # Succeeds when +obj+ responds to each method in +meths+.
24
31
 
@@ -33,9 +40,7 @@ module Minitest::Assertions
33
40
  # regardless of ordering of the items.
34
41
 
35
42
  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
43
+ assert_equal items_1.sort_by(&:hash), items_2.sort_by(&:hash), msg
39
44
  end
40
45
 
41
46
  end
@@ -4,9 +4,15 @@ Please see README
4
4
  =end
5
5
 
6
6
  module Minitest::Expectations
7
- Object.infect_an_assertion :assert_true, :must_be_true, :reverse
8
- Object.infect_an_assertion :assert_false, :must_be_false, :reverse
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
7
+ pairs = [
8
+ [:assert_true, :must_be_true],
9
+ [:assert_false, :must_be_false],
10
+ [:assert_exist, :must_exist],
11
+ [:assert_respond_to_all, :must_respond_to_all],
12
+ [:assert_equal_items, :must_have_equal_items]
13
+ ]
14
+ pairs.each{|k,v|
15
+ Object.infect_an_assertion k, v, :reverse
16
+ }
11
17
  end
12
18
 
@@ -32,6 +32,28 @@ describe "Minitest" do
32
32
 
33
33
  end
34
34
 
35
+ describe "#assert_exit" do
36
+
37
+ specify "true #=> success" do
38
+ assert_exist(true).must_be_same_as true
39
+ end
40
+
41
+ specify "false #=> success" do
42
+ assert_exist(false).must_be_same_as true
43
+ end
44
+
45
+ specify "0 #=> success" do
46
+ assert_exist(0).must_be_same_as true
47
+ end
48
+
49
+ specify "nil #=> failure" do
50
+ proc {
51
+ assert_exist(nil)
52
+ }.must_raise MiniTest::Assertion
53
+ end
54
+
55
+ end
56
+
35
57
  describe "#assert_respond_to_all" do
36
58
 
37
59
  describe "smoke test with some string methods" do
@@ -32,6 +32,28 @@ describe "Minitest" do
32
32
 
33
33
  end
34
34
 
35
+ describe "#must_exist" do
36
+
37
+ specify "true #=> success" do
38
+ true.must_exisit
39
+ end
40
+
41
+ specify "false #=> success" do
42
+ false.must_exisit
43
+ end
44
+
45
+ specify "0 #=> success" do
46
+ false.must_exisit
47
+ end
48
+
49
+ specify "nil #=> failure" do
50
+ proc {
51
+ nil.must_exisit
52
+ }.must_raise MiniTest::Assertion
53
+ end
54
+
55
+ end
56
+
35
57
  describe "#must_respond_to_all" do
36
58
 
37
59
  describe "smoke test with some string methods" do
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SixArm
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- ���bsYɔ���Fk��G����LahT���*0\,�$�ԥ���yi�<̇�W�/���ރ�K�mc�Ĺ���F.J��I�n��VR�Xϻ�L����**?-l[��}�~� 9V1z��ä�
1
+ ]1v�i�õ�JuF��=�''Om=*l����j� ��i��3���F�c J��M��������~��|��hE�0�V�Ȓ�h@N"�{����9��}7��0MC36(�J��6/��s�����\��-