rspec-instrumentation-matcher 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38828dcf2dd2aa2b2f7893a33577bcfb5cb6b29911bad67930d8c7d4f8e0d8e1
|
4
|
+
data.tar.gz: cdfb0c7570d8be5ea6e5aa7d59ce4b2c1105dc1007819086397c65ef300bb0d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86d11074c6490afcc05fce0628e15a15a2dc35f0d0a123515b0b6eed297e96dbe36aa18a701bbe166af2b72e4130c067b7938fed111571a09da6e7ae0ba68ea
|
7
|
+
data.tar.gz: cdfc012186a192b6112be91db88fc6e1985c4b12d9f77332c7bee5279b9a6f3033b13347fd9e5c2b8d3b2da4a20d0f4fc544ef4bc79ecfcc390fd41b24590b97
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (5.2.
|
11
|
+
activesupport (5.2.3)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 0.7, < 2)
|
14
14
|
minitest (~> 5.1)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
celluloid (0.15.2)
|
17
17
|
timers (~> 1.1.0)
|
18
18
|
coderay (1.1.0)
|
19
|
-
concurrent-ruby (1.
|
19
|
+
concurrent-ruby (1.1.5)
|
20
20
|
diff-lcs (1.2.5)
|
21
21
|
ffi (1.9.3)
|
22
22
|
formatador (0.2.5)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
guard-rspec (4.2.9)
|
30
30
|
guard (~> 2.1)
|
31
31
|
rspec (>= 2.14, < 4.0)
|
32
|
-
i18n (1.0
|
32
|
+
i18n (1.6.0)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
34
|
listen (2.7.6)
|
35
35
|
celluloid (>= 0.15.2)
|
@@ -72,4 +72,4 @@ DEPENDENCIES
|
|
72
72
|
rspec-instrumentation-matcher!
|
73
73
|
|
74
74
|
BUNDLED WITH
|
75
|
-
1.
|
75
|
+
1.17.2
|
@@ -7,6 +7,8 @@ module RSpec
|
|
7
7
|
InstrumentMatcher.new(subject)
|
8
8
|
end
|
9
9
|
class InstrumentMatcher
|
10
|
+
include RSpec::Matchers::Composable
|
11
|
+
|
10
12
|
def initialize(subject)
|
11
13
|
@subject = subject
|
12
14
|
@payload = nil
|
@@ -121,14 +123,13 @@ module RSpec
|
|
121
123
|
end
|
122
124
|
|
123
125
|
def delta_payload
|
124
|
-
|
125
|
-
|
126
|
-
end
|
126
|
+
return true if values_match?(@payload_expectation, @payload)
|
127
|
+
@payload.match(@payload_expectation) if @payload.respond_to?(:match)
|
127
128
|
end
|
128
129
|
|
129
130
|
def with?
|
130
131
|
return true unless @with
|
131
|
-
!@payload.nil? && delta_payload
|
132
|
+
!@payload.nil? && delta_payload
|
132
133
|
end
|
133
134
|
|
134
135
|
def matched_value?(expected, actual)
|
@@ -15,7 +15,17 @@ describe RSpec::Instrumentation::Matcher do
|
|
15
15
|
specify { expect { 2.times { event(notification) } }.not_to instrument(notification).never }
|
16
16
|
specify { expect { 2.times { event(notification) } }.to instrument(notification).at_least(1) }
|
17
17
|
specify { expect { 2.times { event(notification) } }.to instrument(notification).at_most(2) }
|
18
|
-
|
18
|
+
|
19
|
+
# test with
|
20
|
+
specify { expect { event(notification, { test_payload: true }) }.to instrument(notification).with(test_payload: true) }
|
21
|
+
specify { expect { event(notification, { test_payload: true }) }.to instrument(notification).with(anything) }
|
22
|
+
specify { expect { event(notification) }.to instrument(notification).with(anything) }
|
23
|
+
|
24
|
+
specify do
|
25
|
+
expect {
|
26
|
+
event(notification,{ test_payload: true, asd: true })
|
27
|
+
}.to instrument(notification).with(hash_including(test_payload: true))
|
28
|
+
end
|
19
29
|
|
20
30
|
context 'when the instrumented block raises an exception' do
|
21
31
|
it 'still unsubscribes the spy subscription' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-instrumentation-matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Verestiuc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-expectations
|
@@ -89,8 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
|
93
|
-
rubygems_version: 2.7.6
|
92
|
+
rubygems_version: 3.0.1
|
94
93
|
signing_key:
|
95
94
|
specification_version: 4
|
96
95
|
summary: Support for spec-ing ActiveSupport::Notifications.instrument calls
|