Class: Salestation::RSpec::FailureMatcher
- Inherits:
-
Object
- Object
- Salestation::RSpec::FailureMatcher
- Includes:
- RSpec::Matchers::Composable
- Defined in:
- lib/salestation/rspec/failure_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
- #containing(matcher) ⇒ Object
- #diffable? ⇒ Boolean
-
#initialize ⇒ FailureMatcher
constructor
A new instance of FailureMatcher.
- #matches?(actual) ⇒ Boolean
- #with(error_class) ⇒ Object
Constructor Details
#initialize ⇒ FailureMatcher
Returns a new instance of FailureMatcher.
12 13 14 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 12 def initialize @contents_matchers = [] end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
10 11 12 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 10 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
10 11 12 |
# File 'lib/salestation/rspec/failure_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/failure_matcher.rb', line 10 def @failure_message end |
Instance Method Details
#containing(matcher) ⇒ Object
44 45 46 47 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 44 def containing(matcher) @contents_matchers << matcher self end |
#diffable? ⇒ Boolean
55 56 57 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 55 def diffable? true end |
#matches?(actual) ⇒ Boolean
49 50 51 52 53 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 49 def matches?(actual) check_failure(actual) && check_error_type(actual) && check_contents(actual) end |
#with(error_class) ⇒ Object
16 17 18 19 |
# File 'lib/salestation/rspec/failure_matcher.rb', line 16 def with(error_class) @error_class = error_class self end |