statsd-instrument 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/statsd/instrument/assertions.rb +4 -0
- data/lib/statsd/instrument/version.rb +1 -1
- data/test/assertions_test.rb +38 -1
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4676e97c70d4ea8a412d1835d5b341e86f7eb056
|
4
|
+
data.tar.gz: 9f3cb9257f3d0e6c3edc152dd45f53e30ad2301c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 272ec7539100efa9e4572114e20f36b6584f3a4a604b4574e7cf3b496c13a125691f102af649d8279317e86bd4758adacabc68b4d5a3c8949149ae18292747fa
|
7
|
+
data.tar.gz: 97fa56c8eff9da0754b0f1ff437c27b365ab701cb3894023caa3eefbbb001a0a66d38d69a8cf52fd46a2061a882e221c71b33e2eb3abe9cdd6bb87b658047a40
|
@@ -6,6 +6,10 @@ module StatsD::Instrument::Assertions
|
|
6
6
|
block.call
|
7
7
|
mock_backend.collected_metrics
|
8
8
|
ensure
|
9
|
+
if old_backend.kind_of?(StatsD::Instrument::Backends::CaptureBackend)
|
10
|
+
old_backend.collected_metrics.concat(mock_backend.collected_metrics)
|
11
|
+
end
|
12
|
+
|
9
13
|
StatsD.backend = old_backend
|
10
14
|
end
|
11
15
|
|
data/test/assertions_test.rb
CHANGED
@@ -113,7 +113,44 @@ class AssertionsTest < Minitest::Test
|
|
113
113
|
StatsD.increment('counter', tags: ['a:b', 'c:d'])
|
114
114
|
end
|
115
115
|
end
|
116
|
-
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_nested_assertions
|
119
|
+
assert_no_assertion_triggered do
|
120
|
+
@test_case.assert_statsd_increment('counter1') do
|
121
|
+
@test_case.assert_statsd_increment('counter2') do
|
122
|
+
StatsD.increment('counter1')
|
123
|
+
StatsD.increment('counter2')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
assert_no_assertion_triggered do
|
129
|
+
@test_case.assert_statsd_increment('counter1') do
|
130
|
+
StatsD.increment('counter1')
|
131
|
+
@test_case.assert_statsd_increment('counter2') do
|
132
|
+
StatsD.increment('counter2')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
assert_assertion_triggered do
|
138
|
+
@test_case.assert_statsd_increment('counter1') do
|
139
|
+
@test_case.assert_statsd_increment('counter2') do
|
140
|
+
StatsD.increment('counter2')
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
assert_assertion_triggered do
|
146
|
+
@test_case.assert_statsd_increment('counter1') do
|
147
|
+
@test_case.assert_statsd_increment('counter2') do
|
148
|
+
StatsD.increment('counter1')
|
149
|
+
end
|
150
|
+
StatsD.increment('counter2')
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
117
154
|
|
118
155
|
private
|
119
156
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd-instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jesse Storimer
|
@@ -10,54 +9,48 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-
|
12
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rake
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: minitest
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: mocha
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - '>='
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
description: A StatsD client for Ruby appspec. Provides metaprogramming methods to
|
@@ -101,27 +94,26 @@ files:
|
|
101
94
|
homepage: https://github.com/Shopify/statsd-instrument
|
102
95
|
licenses:
|
103
96
|
- MIT
|
97
|
+
metadata: {}
|
104
98
|
post_install_message:
|
105
99
|
rdoc_options: []
|
106
100
|
require_paths:
|
107
101
|
- lib
|
108
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
103
|
requirements:
|
111
|
-
- -
|
104
|
+
- - '>='
|
112
105
|
- !ruby/object:Gem::Version
|
113
106
|
version: '0'
|
114
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
108
|
requirements:
|
117
|
-
- -
|
109
|
+
- - '>='
|
118
110
|
- !ruby/object:Gem::Version
|
119
111
|
version: '0'
|
120
112
|
requirements: []
|
121
113
|
rubyforge_project:
|
122
|
-
rubygems_version:
|
114
|
+
rubygems_version: 2.0.14
|
123
115
|
signing_key:
|
124
|
-
specification_version:
|
116
|
+
specification_version: 4
|
125
117
|
summary: A StatsD client for Ruby apps
|
126
118
|
test_files:
|
127
119
|
- test/assertions_test.rb
|