Class: RSpec::MailMatcher::BodyMatcher
- Inherits:
-
Object
- Object
- RSpec::MailMatcher::BodyMatcher
show all
- Defined in:
- lib/rspec/mail_matcher/body_matcher.rb
Instance Method Summary
collapse
Constructor Details
#initialize(expected) ⇒ BodyMatcher
Returns a new instance of BodyMatcher.
3
4
5
|
# File 'lib/rspec/mail_matcher/body_matcher.rb', line 3
def initialize(expected)
@expected = expected
end
|
Instance Method Details
#description ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/rspec/mail_matcher/body_matcher.rb', line 16
def description
if @expected.kind_of?(String)
"have body including #{@expected.inspect}"
else
"have body matching #{@expected.inspect}"
end
end
|
#failure_message ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/rspec/mail_matcher/body_matcher.rb', line 24
def failure_message
if @expected.kind_of?(String)
"expected the body to contain #{@expected.inspect} but was #{mail_body.inspect}"
else
"expected the body to match #{@expected.inspect}, but did not. Actual body was: #{mail_body.inspect}"
end
end
|
#matches?(mail) ⇒ Boolean
7
8
9
10
11
12
13
14
|
# File 'lib/rspec/mail_matcher/body_matcher.rb', line 7
def matches?(mail)
@mail = mail
if @expected.kind_of?(String)
include?
else
match?
end
end
|