Created
January 13, 2012 15:59
-
-
Save nowk/1607139 to your computer and use it in GitHub Desktop.
visit helper for capybara + rspec
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
def visit_the page_to | |
visit page_to | |
end | |
def method_missing(method, *args, &block) | |
if method.to_s =~ /_page$/ | |
route_path = method.to_s.gsub /_page$/, "_path" | |
__send__ route_path, *args | |
else | |
super | |
end | |
end | |
# visit_the edit_admin_post_path(@post) | |
def page_url | |
require 'uri' | |
require 'cgi' | |
current_path = URI.parse(current_url) | |
end | |
# page_url.path.should == admin_posts_path | |
# page_url.should == admin_posts_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment