Class: Operandi::RSpec::Matchers::HaveErrorsOnMatcher
- Inherits:
-
Object
- Object
- Operandi::RSpec::Matchers::HaveErrorsOnMatcher
- Defined in:
- lib/operandi/rspec/matchers/have_error_on.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(keys) ⇒ HaveErrorsOnMatcher
constructor
A new instance of HaveErrorsOnMatcher.
- #matches?(service) ⇒ Boolean
Constructor Details
#initialize(keys) ⇒ HaveErrorsOnMatcher
Returns a new instance of HaveErrorsOnMatcher.
103 104 105 |
# File 'lib/operandi/rspec/matchers/have_error_on.rb', line 103 def initialize(keys) @keys = keys end |
Instance Method Details
#description ⇒ Object
128 129 130 |
# File 'lib/operandi/rspec/matchers/have_error_on.rb', line 128 def description "have errors on #{@keys.inspect}" end |
#failure_message ⇒ Object
118 119 120 121 122 |
# File 'lib/operandi/rspec/matchers/have_error_on.rb', line 118 def "expected service to have errors on #{@keys.inspect}, " \ "but missing errors on: #{@missing_keys.inspect}. " \ "Actual errors: #{errors_summary}" end |
#failure_message_when_negated ⇒ Object
124 125 126 |
# File 'lib/operandi/rspec/matchers/have_error_on.rb', line 124 def "expected service not to have errors on #{@keys.inspect}" end |
#matches?(service) ⇒ Boolean
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/operandi/rspec/matchers/have_error_on.rb', line 107 def matches?(service) @service = service @missing_keys = [] @keys.each do |key| @missing_keys << key unless @service.errors.key?(key) end @missing_keys.empty? end |