Class: Salestation::RSpec::FailureMatcher

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers::Composable
Defined in:
lib/salestation/rspec/failure_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFailureMatcher

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

#actualObject (readonly)

Returns the value of attribute actual.



10
11
12
# File 'lib/salestation/rspec/failure_matcher.rb', line 10

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



10
11
12
# File 'lib/salestation/rspec/failure_matcher.rb', line 10

def expected
  @expected
end

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



10
11
12
# File 'lib/salestation/rspec/failure_matcher.rb', line 10

def failure_message
  @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

Returns:

  • (Boolean)


55
56
57
# File 'lib/salestation/rspec/failure_matcher.rb', line 55

def diffable?
  true
end

#matches?(actual) ⇒ Boolean

Returns:

  • (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