Skip to content

Instantly share code, notes, and snippets.

@til
Created December 20, 2008 02:41
Show Gist options
  • Save til/38214 to your computer and use it in GitHub Desktop.
Save til/38214 to your computer and use it in GitHub Desktop.
module SpecPageRefresh
class SpecPageRefreshMatcher
include Merb::Test::ViewHelper
def matches?(response)
response.should have_selector('form.hidden_refresh')
rescue Spec::Expectations::ExpectationNotMetError
false
end
def failure_message
"Did not include auto refresh form"
end
def negative_failure_message
"Included auto refresh form, but should not"
end
end
def refresh_page
SpecPageRefreshMatcher.new
end
end
# in the specs:
@response.should refresh_page
# and
@response.should_not refresh_page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment