Class: Salestation::RSpec::GliaInputValidationErrorMatcher
- Inherits:
-
Object
- Object
- Salestation::RSpec::GliaInputValidationErrorMatcher
- Includes:
- RSpec::Matchers::Composable
- Defined in:
- lib/salestation/rspec/glia_input_validation_error_matcher.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
Instance Method Summary collapse
-
#initialize ⇒ GliaInputValidationErrorMatcher
constructor
A new instance of GliaInputValidationErrorMatcher.
- #matches?(actual) ⇒ Boolean
- #on(field) ⇒ Object
- #with_type(*types) ⇒ Object
Constructor Details
#initialize ⇒ GliaInputValidationErrorMatcher
Returns a new instance of GliaInputValidationErrorMatcher.
12 13 14 15 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 12 def initialize @fields = [] @field_error_types = {} end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
10 11 12 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 10 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
10 11 12 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 10 def expected @expected end |
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
10 11 12 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 10 def @failure_message end |
Instance Method Details
#matches?(actual) ⇒ Boolean
27 28 29 30 31 32 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 27 def matches?(actual) @fields.all? do |field| check_field_exists(field, actual) && check_field_error_types(field, actual) end end |
#on(field) ⇒ Object
17 18 19 20 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 17 def on(field) @fields << field self end |
#with_type(*types) ⇒ Object
22 23 24 25 |
# File 'lib/salestation/rspec/glia_input_validation_error_matcher.rb', line 22 def with_type(*types) @field_error_types[@fields.last] = types self end |