remockable 0.3.10 → 0.3.11
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/lib/remockable/active_model/allow_values_for.rb +14 -11
- data/lib/remockable/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df2a71c32560044a4bb4f07d99fe2f403436b9adcc6398ea770c9feaa9ccb703
|
4
|
+
data.tar.gz: 1263b76faad22af9698ee522a57aa94ac448fd92f7be43958c6ce09f1374d6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de47fd028909651d898e0b619e86c0abf5ac34682951dcf8166e63be51db1c8be466a85849be8422d381ecddfda823df79f12174126ff4a31769bded4cffad1d
|
7
|
+
data.tar.gz: 7a635532c8fed30a9e49d02ec58326afff814bfb6b656c0730c05385289d54d4657a09a431933ee1afa0eef60bdffac141e2120216efce7dc58547331250c7de
|
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
RSpec::Matchers.define(:allow_values_for) do
|
2
2
|
include Remockable::ActiveModel::Helpers
|
3
3
|
|
4
|
-
def values
|
5
|
-
expected_as_array[1..-1]
|
6
|
-
end
|
7
|
-
|
8
4
|
match do |actual|
|
9
5
|
values.all? do |value|
|
10
|
-
|
11
|
-
subject.send(:"#{attribute}=", value)
|
12
|
-
else
|
13
|
-
allow(subject).to receive(attribute).and_return(value)
|
14
|
-
end
|
15
|
-
|
6
|
+
assign_value attribute, value
|
16
7
|
subject.valid?
|
17
8
|
subject.errors[attribute].empty?
|
18
9
|
end
|
@@ -20,7 +11,7 @@ RSpec::Matchers.define(:allow_values_for) do
|
|
20
11
|
|
21
12
|
match_when_negated do |actual|
|
22
13
|
values.none? do |value|
|
23
|
-
|
14
|
+
assign_value attribute, value
|
24
15
|
subject.valid?
|
25
16
|
subject.errors[attribute].empty?
|
26
17
|
end
|
@@ -37,4 +28,16 @@ RSpec::Matchers.define(:allow_values_for) do
|
|
37
28
|
description do
|
38
29
|
"allow the values #{values.collect(&:inspect).to_sentence} for #{attribute}"
|
39
30
|
end
|
31
|
+
|
32
|
+
def assign_value(attribute, value)
|
33
|
+
if subject.respond_to?(:"#{attribute}=")
|
34
|
+
subject.send(:"#{attribute}=", value)
|
35
|
+
else
|
36
|
+
allow(subject).to receive(attribute).and_return(value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def values
|
41
|
+
expected_as_array[1..-1]
|
42
|
+
end
|
40
43
|
end
|
data/lib/remockable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remockable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Hunt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -154,8 +154,8 @@ dependencies:
|
|
154
154
|
- - "~>"
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: 1.4.2
|
157
|
-
description:
|
158
|
-
email:
|
157
|
+
description:
|
158
|
+
email:
|
159
159
|
executables: []
|
160
160
|
extensions: []
|
161
161
|
extra_rdoc_files: []
|
@@ -238,7 +238,7 @@ homepage: http://github.com/tylerhunt/remockable
|
|
238
238
|
licenses:
|
239
239
|
- MIT
|
240
240
|
metadata: {}
|
241
|
-
post_install_message:
|
241
|
+
post_install_message:
|
242
242
|
rdoc_options: []
|
243
243
|
require_paths:
|
244
244
|
- lib
|
@@ -253,9 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: '0'
|
255
255
|
requirements: []
|
256
|
-
|
257
|
-
|
258
|
-
signing_key:
|
256
|
+
rubygems_version: 3.4.10
|
257
|
+
signing_key:
|
259
258
|
specification_version: 4
|
260
259
|
summary: A collection of RSpec matchers for web apps.
|
261
260
|
test_files:
|