Created
November 25, 2009 06:21
-
-
Save ajsharp/242521 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OptimisMatchers | |
def self.generate_matcher(matcher_name, url) | |
OptimisMatchers::module_eval do | |
Spec::Matchers.define matcher_name do | |
match do |actual| | |
actual.redirect_url == url | |
end | |
failure_message_for_should do |actual| | |
if actual.redirect? | |
"Expected redirect to #{url} but redirected to #{actual.redirect_url}" | |
else | |
"Expected redirect, didn't get one." | |
end | |
end | |
end | |
end | |
end | |
generate_matcher :require_practice, 'http://test.host/user/settings/current_practice' | |
generate_matcher :require_clinic, 'http://test.host/user/settings/current_clinic' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment