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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5492de95e8e21114d1b6e9561bf73137b943dfabcffe4308ad201d92e966405e
4
- data.tar.gz: ae94c8bfe61f44b63b85812f3d92527f90fd6f28787e4aa21dbbb549bf6cfee9
3
+ metadata.gz: df2a71c32560044a4bb4f07d99fe2f403436b9adcc6398ea770c9feaa9ccb703
4
+ data.tar.gz: 1263b76faad22af9698ee522a57aa94ac448fd92f7be43958c6ce09f1374d6d6
5
5
  SHA512:
6
- metadata.gz: 6acbc06082392f6ca96362bd9082215fd0fdf38eff2f745bcd44faf09245ce18252e7fbf47643b19d7dd0223a9c3700c7d2f16c493f23df9a24d3f11a738d3fe
7
- data.tar.gz: 24325ec462e5250420f8f6b6f1dda50044c36577dfdc48690560b79651c54d96ec9385e853d1b51eea05ab585712564eae18fb3016cd03b7228ce49dd1a1f24c
6
+ metadata.gz: de47fd028909651d898e0b619e86c0abf5ac34682951dcf8166e63be51db1c8be466a85849be8422d381ecddfda823df79f12174126ff4a31769bded4cffad1d
7
+ data.tar.gz: 7a635532c8fed30a9e49d02ec58326afff814bfb6b656c0730c05385289d54d4657a09a431933ee1afa0eef60bdffac141e2120216efce7dc58547331250c7de
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.11 (2024-03-07)
4
+
5
+ * Fix `allow_values_for` matcher when negated ([Tyler Hunt][tylerhunt])
6
+
3
7
  ## 0.3.10 (2024-02-08)
4
8
 
5
9
  * Support symbol values for `:reject_if` option on
@@ -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
- if subject.respond_to?(:"#{attribute}=")
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
- allow(subject).to receive(attribute).and_return(value)
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
@@ -1,3 +1,3 @@
1
1
  module Remockable
2
- VERSION = '0.3.10'
2
+ VERSION = '0.3.11'
3
3
  end
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.10
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-02-08 00:00:00.000000000 Z
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
- rubyforge_project:
257
- rubygems_version: 2.7.6.3
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: