nowk
1/13/2012 - 3:59 PM

visit helper for capybara + rspec

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