Class: Consul::Spec::Matchers::CheckPower
- Inherits:
-
Object
- Object
- Consul::Spec::Matchers::CheckPower
- Defined in:
- lib/consul/spec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(*args) ⇒ CheckPower
constructor
A new instance of CheckPower.
- #matches?(controller) ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ CheckPower
Returns a new instance of CheckPower.
7 8 9 |
# File 'lib/consul/spec/matchers.rb', line 7 def initialize(*args) @expected_args = args end |
Instance Method Details
#description ⇒ Object
27 28 29 30 |
# File 'lib/consul/spec/matchers.rb', line 27 def description description = "check against power #{@expected_args.inspect}" description end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/consul/spec/matchers.rb', line 17 def "expected #{@controller_class} to check against power #{@expected_args.inspect} but it checked against #{@actual_args.inspect}" end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
21 22 23 |
# File 'lib/consul/spec/matchers.rb', line 21 def "expected #{@controller_class} to not check against power #{@expected_args.inspect}" end |
#matches?(controller) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/consul/spec/matchers.rb', line 11 def matches?(controller) @controller_class = controller.class @actual_args = @controller_class.send(:consul_power_args) @actual_args.present? && @actual_args.include?(@expected_args) end |