class EmailSpec::Matchers::HaveSubject
Public Class Methods
new(subject)
click to toggle source
# File lib/email_spec/matchers.rb, line 185 def initialize(subject) @expected_subject = subject end
Public Instance Methods
description()
click to toggle source
# File lib/email_spec/matchers.rb, line 189 def description if @expected_subject.is_a?(String) "have subject of #{@expected_subject.inspect}" else "have subject matching #{@expected_subject.inspect}" end end
failure_message()
click to toggle source
# File lib/email_spec/matchers.rb, line 206 def failure_message if @expected_subject.is_a?(String) "expected the subject to be #{@expected_subject.inspect} but was #{@given_subject.inspect}" else "expected the subject to match #{@expected_subject.inspect}, but did not. Actual subject was: #{@given_subject.inspect}" end end
failure_message_when_negated()
click to toggle source
# File lib/email_spec/matchers.rb, line 214 def failure_message_when_negated if @expected_subject.is_a?(String) "expected the subject not to be #{@expected_subject.inspect} but was" else "expected the subject not to match #{@expected_subject.inspect} but #{@given_subject.inspect} does match it." end end
Also aliased as: negative_failure_message
matches?(email)
click to toggle source
# File lib/email_spec/matchers.rb, line 197 def matches?(email) @given_subject = email.subject if @expected_subject.is_a?(String) @given_subject == @expected_subject else !!(@given_subject =~ @expected_subject) end end