minitest-mock_expectations 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/CHANGELOG.md +9 -1
- data/Gemfile.lock +4 -4
- data/README.md +8 -2
- data/lib/minitest/mock_expectations/assertions.rb +7 -3
- data/lib/minitest/mock_expectations/version.rb +1 -1
- data/minitest-mock_expectations.gemspec +2 -0
- data/test/minitest/mock_expectations/assertions_test.rb +8 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2284c5dff2f8161f4b7db2f38860b6cb6b5d74cecc16b33540b9b95de9548c7e
|
4
|
+
data.tar.gz: 82c4b5a483530764b24de76db7c17fbccbc3ab35827975aba68fbd218c874cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 133cd5823440d4b6e44819bb06a5e4547e373a70039bbfc29f0f69b79ede717eb31922db8494cd9a36031678918bf2f7ce4ff5b81e218de5378a252cd595e2de
|
7
|
+
data.tar.gz: f07f751451486ef687a2d4b5c1df57d1ba280b41ff01442a005584dda11ea791fb019ea2770f17fb8c946361e1e7f81bc5a085b23e5744ebdbc06363c7b136d0
|
data/.github/workflows/ci.yml
CHANGED
@@ -7,11 +7,11 @@ jobs:
|
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby: [
|
10
|
+
ruby: [3.0, 3.1, 3.2, head, jruby, jruby-head, truffleruby, truffleruby-head]
|
11
11
|
steps:
|
12
12
|
- uses: actions/checkout@v2
|
13
13
|
- name: Set up Ruby
|
14
|
-
uses:
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
16
16
|
ruby-version: ${{ matrix.ruby }}
|
17
17
|
- name: Install dependencies
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
### 1.
|
1
|
+
### 1.2.0 / January 7, 2022
|
2
|
+
|
3
|
+
* Drop support for Ruby < 3.0.
|
4
|
+
|
5
|
+
### 1.1.3 / April 24, 2020
|
6
|
+
|
7
|
+
* Revert "Fix `assert_called_with` with an array as expected argument.".
|
8
|
+
|
9
|
+
### 1.1.2 / April 24, 2020
|
2
10
|
|
3
11
|
* Fix `assert_called_with` with an array as expected argument.
|
4
12
|
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
minitest-mock_expectations (1.
|
4
|
+
minitest-mock_expectations (1.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
minitest (5.
|
10
|
-
rake (
|
9
|
+
minitest (5.17.0)
|
10
|
+
rake (13.0.6)
|
11
11
|
|
12
12
|
PLATFORMS
|
13
13
|
ruby
|
@@ -19,4 +19,4 @@ DEPENDENCIES
|
|
19
19
|
rake
|
20
20
|
|
21
21
|
BUNDLED WITH
|
22
|
-
2.
|
22
|
+
2.4.3
|
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)
|
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
+
spec.required_ruby_version = ">= 3.0"
|
20
|
+
|
19
21
|
spec.add_development_dependency "bundler"
|
20
22
|
spec.add_development_dependency "rake"
|
21
23
|
spec.add_development_dependency "minitest"
|
@@ -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."])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-mock_expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanvlviv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,14 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
88
|
+
version: '3.0'
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.1
|
95
|
+
rubygems_version: 3.4.1
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Provides method call assertions for minitest
|