Class: StatsD::Instrument::Matchers::Matcher
- Inherits:
-
Object
- Object
- StatsD::Instrument::Matchers::Matcher
show all
- Includes:
- RSpec::Matchers::Composable, Helpers
- Defined in:
- lib/statsd/instrument/matchers.rb
Instance Method Summary
collapse
Methods included from Helpers
add_tag, #capture_statsd_datagrams, prefix_metric, prefixed_metric?
Constructor Details
#initialize(metric_type, metric_name, options = {}) ⇒ Matcher
Returns a new instance of Matcher.
13
14
15
16
17
|
# File 'lib/statsd/instrument/matchers.rb', line 13
def initialize(metric_type, metric_name, options = {})
@metric_type = metric_type
@metric_name = metric_name
@options = options
end
|
Instance Method Details
#description ⇒ Object
38
39
40
|
# File 'lib/statsd/instrument/matchers.rb', line 38
def description
"trigger a statsd call for metric #{@metric_name}"
end
|
#failure_message ⇒ Object
26
27
28
|
# File 'lib/statsd/instrument/matchers.rb', line 26
def failure_message
@message
end
|
#failure_message_when_negated ⇒ Object
30
31
32
|
# File 'lib/statsd/instrument/matchers.rb', line 30
def failure_message_when_negated
"No StatsD calls for metric #{@metric_name} expected."
end
|
#matches?(block) ⇒ Boolean
19
20
21
22
23
24
|
# File 'lib/statsd/instrument/matchers.rb', line 19
def matches?(block)
expect_statsd_call(@metric_type, @metric_name, @options, &block)
rescue RSpec::Expectations::ExpectationNotMetError => e
@message = e.message
false
end
|
#supports_block_expectations? ⇒ Boolean
34
35
36
|
# File 'lib/statsd/instrument/matchers.rb', line 34
def supports_block_expectations?
true
end
|