Class: StatsD::Instrument::Matchers::Matcher
- Inherits:
-
Object
- Object
- StatsD::Instrument::Matchers::Matcher
- Includes:
- RSpec::Matchers::Composable, Helpers
- Defined in:
- lib/statsd/instrument/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(metric_type, metric_name, options = {}) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(block) ⇒ Boolean
- #supports_block_expectations? ⇒ Boolean
Methods included from Helpers
Constructor Details
#initialize(metric_type, metric_name, options = {}) ⇒ Matcher
Returns a new instance of Matcher.
18 19 20 21 22 |
# File 'lib/statsd/instrument/matchers.rb', line 18 def initialize(metric_type, metric_name, = {}) @metric_type = metric_type @metric_name = metric_name @options = end |
Instance Method Details
#failure_message ⇒ Object
34 35 36 |
# File 'lib/statsd/instrument/matchers.rb', line 34 def @message end |
#failure_message_when_negated ⇒ Object
38 39 40 |
# File 'lib/statsd/instrument/matchers.rb', line 38 def "No StatsD calls for metric #{@metric_name} expected." end |
#matches?(block) ⇒ Boolean
24 25 26 27 28 29 30 31 32 |
# File 'lib/statsd/instrument/matchers.rb', line 24 def matches?(block) begin expect_statsd_call(@metric_type, @metric_name, @options, &block) rescue RSpec::Expectations::ExpectationNotMetError => e @message = e. false end end |
#supports_block_expectations? ⇒ Boolean
42 43 44 |
# File 'lib/statsd/instrument/matchers.rb', line 42 def supports_block_expectations? true end |