minitest-mock_expectations 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/README.md +8 -2
- data/lib/minitest/mock_expectations/assertions.rb +7 -3
- data/lib/minitest/mock_expectations/version.rb +1 -1
- data/test/minitest/mock_expectations/assertions_test.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1419043ab236bcdc59b750babd75560159109bb694867a686c6fc723d67b7585
|
4
|
+
data.tar.gz: 510d6192b4be603cfc422f4e1524e2f35b96f85972629c836d633f5ba595511e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5c7fd6a463a7acebe7f53dcefa21ee6158dec1065e72b97ce7879ae630c48a98866f4268765bb4c4bcbd625e87367a3cb73aefe2634dcb1e31025d97d0cd671
|
7
|
+
data.tar.gz: 24285ebaff1c6fa31b5198eb5eb57d56958d68462e7cbc024d430a1e071ef7a946061f6e851f7f9954a31cd99563bb6cc81b34d7ebab7457013cc1352dc59ccb
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -137,17 +137,23 @@ end
|
|
137
137
|
```
|
138
138
|
|
139
139
|
```ruby
|
140
|
-
assert_called_with(@post, :add_comment, [["Thanks for sharing this."]]) do
|
140
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this."]]]) do
|
141
141
|
@post.add_comment(["Thanks for sharing this."])
|
142
142
|
end
|
143
143
|
```
|
144
144
|
|
145
145
|
```ruby
|
146
|
-
assert_called_with(@post, :add_comment, [["Thanks for sharing this.", "Thanks!"]]) do
|
146
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this.", "Thanks!"]]]) do
|
147
147
|
@post.add_comment(["Thanks for sharing this.", "Thanks!"])
|
148
148
|
end
|
149
149
|
```
|
150
150
|
|
151
|
+
```ruby
|
152
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this."], ["Thanks!"]]]) do
|
153
|
+
@post.add_comment(["Thanks for sharing this."], ["Thanks!"])
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
151
157
|
```ruby
|
152
158
|
assert_called_with(@post, :add_comment, [["Thanks for sharing this."], {body: "Thanks!"}]) do
|
153
159
|
@post.add_comment(["Thanks for sharing this."], {body: "Thanks!"})
|
@@ -99,14 +99,18 @@ module Minitest
|
|
99
99
|
# @post.add_comment("Thanks!")
|
100
100
|
# end
|
101
101
|
#
|
102
|
-
# assert_called_with(@post, :add_comment, [["Thanks for sharing this."]]) do
|
102
|
+
# assert_called_with(@post, :add_comment, [[["Thanks for sharing this."]]]) do
|
103
103
|
# @post.add_comment(["Thanks for sharing this."])
|
104
104
|
# end
|
105
105
|
#
|
106
|
-
# assert_called_with(@post, :add_comment, [["Thanks for sharing this.", "Thanks!"]]) do
|
106
|
+
# assert_called_with(@post, :add_comment, [[["Thanks for sharing this.", "Thanks!"]]]) do
|
107
107
|
# @post.add_comment(["Thanks for sharing this.", "Thanks!"])
|
108
108
|
# end
|
109
109
|
#
|
110
|
+
# assert_called_with(@post, :add_comment, [[["Thanks for sharing this."], ["Thanks!"]]]) do
|
111
|
+
# @post.add_comment(["Thanks for sharing this."], ["Thanks!"])
|
112
|
+
# end
|
113
|
+
#
|
110
114
|
# assert_called_with(@post, :add_comment, [["Thanks for sharing this."], {body: "Thanks!"}]) do
|
111
115
|
# @post.add_comment(["Thanks for sharing this."], {body: "Thanks!"})
|
112
116
|
# end
|
@@ -124,7 +128,7 @@ module Minitest
|
|
124
128
|
def assert_called_with(object, method_name, arguments, returns: nil)
|
125
129
|
mock = Minitest::Mock.new
|
126
130
|
|
127
|
-
if arguments.
|
131
|
+
if arguments.all? { |argument| argument.is_a?(Array) }
|
128
132
|
arguments.each { |argument| mock.expect(:call, returns, argument) }
|
129
133
|
else
|
130
134
|
mock.expect(:call, returns, arguments)
|
@@ -147,15 +147,21 @@ class Minitest::MockExpectations::AssertionsTest < Minitest::Test
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def test_assert_called_with_an_array_as_expected_argument
|
150
|
-
assert_called_with(@post, :add_comment, [["Thanks for sharing this."]]) do
|
150
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this."]]]) do
|
151
151
|
@post.add_comment(["Thanks for sharing this."])
|
152
152
|
end
|
153
153
|
|
154
|
-
assert_called_with(@post, :add_comment, [["Thanks for sharing this.", "Thanks!"]]) do
|
154
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this.", "Thanks!"]]]) do
|
155
155
|
@post.add_comment(["Thanks for sharing this.", "Thanks!"])
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
+
def test_assert_called_with_expected_arguments_as_arrays
|
160
|
+
assert_called_with(@post, :add_comment, [[["Thanks for sharing this."], ["Thanks!"]]]) do
|
161
|
+
@post.add_comment(["Thanks for sharing this."], ["Thanks!"])
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
159
165
|
def test_assert_called_with_multiple_expected_arguments_as_arrays
|
160
166
|
assert_called_with(@post, :add_comment, [[["Thanks for sharing this."]], [["Thanks!"]]]) do
|
161
167
|
@post.add_comment(["Thanks for sharing this."])
|