rspec-instrumentation-matcher 0.0.6 → 0.0.7

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: 8467c604dd5d08c30de5e04b5e729cc0487fb1302c2cd7a960f72060f67a9505
4
- data.tar.gz: 10946f0c6b8c829765b8d0aac9e86a2974ccf8693c24af6ed8821a385015b260
3
+ metadata.gz: 38828dcf2dd2aa2b2f7893a33577bcfb5cb6b29911bad67930d8c7d4f8e0d8e1
4
+ data.tar.gz: cdfb0c7570d8be5ea6e5aa7d59ce4b2c1105dc1007819086397c65ef300bb0d7
5
5
  SHA512:
6
- metadata.gz: 24023b18d3d8559dc3cc42f23fe3d82de50519ac6981857863422dc585cff2372db0ce605a5f33481a84203721d4cf3429965bba29f996c65eab685957d7e649
7
- data.tar.gz: 5794a1bbd85c4ae6416e7744e8fb156bc4430af4639f9377a7787d59492f225459aba44d24706f9a57445ec0910f88e83e08fadfecdaf2cac9907951d27b9898
6
+ metadata.gz: f86d11074c6490afcc05fce0628e15a15a2dc35f0d0a123515b0b6eed297e96dbe36aa18a701bbe166af2b72e4130c067b7938fed111571a09da6e7ae0ba68ea
7
+ data.tar.gz: cdfc012186a192b6112be91db88fc6e1985c4b12d9f77332c7bee5279b9a6f3033b13347fd9e5c2b8d3b2da4a20d0f4fc544ef4bc79ecfcc390fd41b24590b97
@@ -8,7 +8,7 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.0)
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.0.5)
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.1)
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.16.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
- unmatched = @payload_expectation.reject do |key, value|
125
- matched_value?(value, @payload[key]) if @payload.key? key
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.empty?
132
+ !@payload.nil? && delta_payload
132
133
  end
133
134
 
134
135
  def matched_value?(expected, actual)
@@ -1,7 +1,7 @@
1
1
  module Rspec
2
2
  module Instrumentation
3
3
  module Matcher
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.7"
5
5
  end
6
6
  end
7
7
  end
@@ -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
- specify { expect { event(notification,{ test_payload: true }) }.to instrument(notification).with(test_payload: true) }
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.6
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: 2018-07-01 00:00:00.000000000 Z
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
- rubyforge_project:
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