media_types 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/media_types/minitest/assert_media_types_registered.rb +36 -13
- data/lib/media_types/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289075ecf2d6af18c0c90f5e16a1dbd99e2192aa
|
4
|
+
data.tar.gz: c3834ae46284989bbdd47c007af6e6ad4d59fc3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea836cc120dfd87c39d96f59119fe27fe1b101a24b331edd919d4662d717b621ce94fa77c7aaec7a8b4b2f8a415f6e46bf3febea232eee1a11eb6f4d06b757be
|
7
|
+
data.tar.gz: adb3dafa03155c97f88391d68c28d583b121696ba6730a16b8f08d6744b893686d91263c3079349a715f0a92e9213f1fe7e0f44105a3bc326bb8f7b39be932eb
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -105,6 +105,8 @@ module MediaTypes
|
|
105
105
|
mock = Minitest::Mock.new
|
106
106
|
uncalled = expected_types_hash.dup
|
107
107
|
|
108
|
+
failed = []
|
109
|
+
|
108
110
|
uncalled.length.times do
|
109
111
|
mock.expect(:call, nil) do |registerable|
|
110
112
|
type = registerable.to_s
|
@@ -112,20 +114,24 @@ module MediaTypes
|
|
112
114
|
synonyms = registerable.synonyms
|
113
115
|
|
114
116
|
options = uncalled.delete(type)
|
115
|
-
options && options == [symbol, synonyms]
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
117
|
+
return true if options && options == [symbol, synonyms] && pass
|
118
|
+
|
119
|
+
failed <<
|
120
|
+
MockExpectationError.new(
|
121
|
+
format(
|
122
|
+
'Call failed to match expectations:' + "\n"\
|
123
|
+
'+++ actual [type: %<type>s, symbol: %<symbol>s, synonyms: %<synonyms>s]' + "\n"\
|
124
|
+
'--- expected [type: %<type>s, symbol: %<resolved_symbol>s, synonyms: %<resolved_synonyms>s]',
|
125
|
+
type: type,
|
126
|
+
symbol: symbol,
|
127
|
+
synonyms: synonyms,
|
128
|
+
resolved_symbol: options&.first,
|
129
|
+
resolved_synonyms: options&.last
|
130
|
+
)
|
126
131
|
)
|
127
|
-
)
|
128
132
|
end
|
133
|
+
|
134
|
+
false
|
129
135
|
end
|
130
136
|
|
131
137
|
MediaTypes.stub(:register, mock) do
|
@@ -136,7 +142,24 @@ module MediaTypes
|
|
136
142
|
end
|
137
143
|
end
|
138
144
|
|
139
|
-
|
145
|
+
messages = failed.map(&:message)
|
146
|
+
uncalled.each do |type, options|
|
147
|
+
messages << format(
|
148
|
+
'Call did not occur:' + "\n"\
|
149
|
+
'--- expected: [type: %<type>s, symbol: %<resolved_symbol>s, synonyms: %<resolved_synonyms>s]',
|
150
|
+
type: type,
|
151
|
+
resolved_symbol: options&.first,
|
152
|
+
resolved_synonyms: options&.last
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
if messages.length.positive?
|
157
|
+
flunk messages.join(",\n")
|
158
|
+
else
|
159
|
+
pass
|
160
|
+
end
|
161
|
+
|
162
|
+
assert mock
|
140
163
|
end
|
141
164
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
142
165
|
end
|
data/lib/media_types/version.rb
CHANGED