Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 rspec + capybara - current_path is nil?

I have this in my users_spec.rb

  scenario "Go to contact page" do
    visit "/contact"
    current_path.should == contact_path
  end

After running rspec, I get

Failure/Error: current_path.should == contact_path
       expected: "/contact"
            got: nil (using ==)

For some reason, current_path seem to be returning nil. Is there a configuration that I am missing?

like image 215
Min Ming Lo Avatar asked Dec 05 '11 07:12

Min Ming Lo


1 Answers

Authors answer:

Min Ming Lo

It turns out that because webrat is also included, there was some sort of conflict. I commented out my webrat from my gem file (which I wasn't using anyway). It was included earlier for some other testing (and also due to many outdated tutorials out there).

like image 94
Mark Huk Avatar answered Oct 22 '22 19:10

Mark Huk