Skip to content

Instantly share code, notes, and snippets.

@nowk
Created January 13, 2012 15:59
Show Gist options
  • Save nowk/1607139 to your computer and use it in GitHub Desktop.
Save nowk/1607139 to your computer and use it in GitHub Desktop.
visit helper for capybara + rspec
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