Skip to content

Instantly share code, notes, and snippets.

Created January 14, 2009 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/46858 to your computer and use it in GitHub Desktop.
Save anonymous/46858 to your computer and use it in GitHub Desktop.
module Matchers
class HaveNotice
def initialize(contents)
@contents = contents
end
def matches?(response_or_text)
@actual = response_or_text.respond_to?(:body) ? response_or_text.body : response_or_text
@actual.have_tag('div.notice', @contents)
end
def failure_message
"expected response to contain #{@contents} but it didn't"
end
def negative_failure_message
"expected response to not contain #{@contents} but it did"
end
end
def have_notice(contents)
HaveNotice.new(contents)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment