rspec-instrumentation-matcher 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +72 -0
- data/Guardfile +9 -0
- data/lib/rspec-instrumentation-matcher.rb +17 -1
- data/lib/rspec-instrumentation-matcher/version.rb +1 -1
- data/rspec-instrumentation-matcher.gemspec +4 -0
- data/spec/rspec-instrumentation-matcher_spec.rb +20 -0
- data/spec/spec_helper.rb +5 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 539ee1e205d5e7e5ca496e11c38af0a38f7d436e
|
4
|
+
data.tar.gz: 962d456600fef1e8c4959a151c2eaf18e8e4f6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de975bd43cf60ce0b7dee62f4e71c533f5a17001786e802d854a26691046bd9a6a630f265531c5d93da1588e66d93ec11d48f84b9290df6f4d1f9554c9d83351
|
7
|
+
data.tar.gz: ae2a6afdd15bc84ec4cd2489c8cdc9edc72cb442a9a20438a463a7c219514cb08bf74bbebbcdd51f601e25e9650db07e5c86f78828739b3e87175a2cb1af98f5
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec-instrumentation-matcher (0.0.3)
|
5
|
+
activesupport
|
6
|
+
rspec-expectations
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (4.1.1)
|
12
|
+
i18n (~> 0.6, >= 0.6.9)
|
13
|
+
json (~> 1.7, >= 1.7.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
thread_safe (~> 0.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
celluloid (0.15.2)
|
18
|
+
timers (~> 1.1.0)
|
19
|
+
coderay (1.1.0)
|
20
|
+
diff-lcs (1.2.5)
|
21
|
+
ffi (1.9.3)
|
22
|
+
formatador (0.2.5)
|
23
|
+
guard (2.6.1)
|
24
|
+
formatador (>= 0.2.4)
|
25
|
+
listen (~> 2.7)
|
26
|
+
lumberjack (~> 1.0)
|
27
|
+
pry (>= 0.9.12)
|
28
|
+
thor (>= 0.18.1)
|
29
|
+
guard-rspec (4.2.9)
|
30
|
+
guard (~> 2.1)
|
31
|
+
rspec (>= 2.14, < 4.0)
|
32
|
+
i18n (0.6.9)
|
33
|
+
json (1.8.1)
|
34
|
+
listen (2.7.6)
|
35
|
+
celluloid (>= 0.15.2)
|
36
|
+
rb-fsevent (>= 0.9.3)
|
37
|
+
rb-inotify (>= 0.9)
|
38
|
+
lumberjack (1.0.6)
|
39
|
+
method_source (0.8.2)
|
40
|
+
minitest (5.3.4)
|
41
|
+
pry (0.9.12.6)
|
42
|
+
coderay (~> 1.0)
|
43
|
+
method_source (~> 0.8)
|
44
|
+
slop (~> 3.4)
|
45
|
+
rb-fsevent (0.9.4)
|
46
|
+
rb-inotify (0.9.4)
|
47
|
+
ffi (>= 0.5.0)
|
48
|
+
rspec (3.0.0)
|
49
|
+
rspec-core (~> 3.0.0)
|
50
|
+
rspec-expectations (~> 3.0.0)
|
51
|
+
rspec-mocks (~> 3.0.0)
|
52
|
+
rspec-core (3.0.0)
|
53
|
+
rspec-support (~> 3.0.0)
|
54
|
+
rspec-expectations (3.0.0)
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
+
rspec-support (~> 3.0.0)
|
57
|
+
rspec-mocks (3.0.0)
|
58
|
+
rspec-support (~> 3.0.0)
|
59
|
+
rspec-support (3.0.0)
|
60
|
+
slop (3.5.0)
|
61
|
+
thor (0.19.1)
|
62
|
+
thread_safe (0.3.4)
|
63
|
+
timers (1.1.0)
|
64
|
+
tzinfo (1.2.1)
|
65
|
+
thread_safe (~> 0.1)
|
66
|
+
|
67
|
+
PLATFORMS
|
68
|
+
ruby
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
guard-rspec
|
72
|
+
rspec-instrumentation-matcher!
|
data/Guardfile
ADDED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rspec-instrumentation-matcher/version"
|
2
|
-
|
2
|
+
require 'active_support/notifications'
|
3
3
|
module RSpec
|
4
4
|
module Instrumentation
|
5
5
|
module Matcher
|
@@ -15,6 +15,10 @@ module RSpec
|
|
15
15
|
@at_least = 1
|
16
16
|
end
|
17
17
|
|
18
|
+
def description
|
19
|
+
"instrument #{@subject} #{expectation_message}"
|
20
|
+
end
|
21
|
+
|
18
22
|
def supports_block_expectations?
|
19
23
|
true
|
20
24
|
end
|
@@ -62,6 +66,7 @@ module RSpec
|
|
62
66
|
|
63
67
|
def at_most(value)
|
64
68
|
@at_most = value
|
69
|
+
@at_least = nil
|
65
70
|
self
|
66
71
|
end
|
67
72
|
|
@@ -76,6 +81,7 @@ module RSpec
|
|
76
81
|
|
77
82
|
|
78
83
|
def times(value)
|
84
|
+
@at_least = nil
|
79
85
|
@times = value
|
80
86
|
self
|
81
87
|
end
|
@@ -133,6 +139,16 @@ module RSpec
|
|
133
139
|
end
|
134
140
|
end
|
135
141
|
|
142
|
+
def expectation_message
|
143
|
+
message = ""
|
144
|
+
message << "at least #{count @at_least}" unless @at_least.nil?
|
145
|
+
message << "at most #{count @at_most}" unless @at_most.nil?
|
146
|
+
message << "exactly #{count @times}" unless @times.nil?
|
147
|
+
if @with
|
148
|
+
message << " with payload #{@payload.inspect}"
|
149
|
+
end
|
150
|
+
message
|
151
|
+
end
|
136
152
|
|
137
153
|
end
|
138
154
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe RSpec::Instrumentation::Matcher do
|
5
|
+
|
6
|
+
def event(notification, payload={})
|
7
|
+
ActiveSupport::Notifications.instrument(notification, payload)
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
let(:notification) { 'a notification' }
|
12
|
+
|
13
|
+
specify { expect { event(notification) }.to instrument(notification).once }
|
14
|
+
specify { expect { 2.times { event(notification) } }.not_to instrument(notification).never }
|
15
|
+
specify { expect { 2.times { event(notification) } }.to instrument(notification).at_least(1) }
|
16
|
+
specify { expect { 2.times { event(notification) } }.to instrument(notification).at_most(2) }
|
17
|
+
specify { expect { event(notification,{ test_payload: true }) }.to instrument(notification).with(test_payload: true) }
|
18
|
+
|
19
|
+
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Verestiuc
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Rspec matcher for ActiveSupport::Notifications
|
42
56
|
email:
|
43
57
|
- vlad.verestiuc@me.com
|
@@ -47,12 +61,16 @@ extra_rdoc_files: []
|
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
49
63
|
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- Guardfile
|
50
66
|
- LICENSE.txt
|
51
67
|
- README.md
|
52
68
|
- Rakefile
|
53
69
|
- lib/rspec-instrumentation-matcher.rb
|
54
70
|
- lib/rspec-instrumentation-matcher/version.rb
|
55
71
|
- rspec-instrumentation-matcher.gemspec
|
72
|
+
- spec/rspec-instrumentation-matcher_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
56
74
|
homepage: https://github.com/vvlad/rspec-instrumentation-matcher
|
57
75
|
licenses: []
|
58
76
|
metadata: {}
|
@@ -76,5 +94,7 @@ rubygems_version: 2.2.2
|
|
76
94
|
signing_key:
|
77
95
|
specification_version: 4
|
78
96
|
summary: Support for spec-ing ActiveSupport::Notifications.instrument calls
|
79
|
-
test_files:
|
97
|
+
test_files:
|
98
|
+
- spec/rspec-instrumentation-matcher_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
80
100
|
has_rdoc:
|