I just started creating test with capybara and I am facing a problem already.
So I have a before do which is creating a row in the DB with a value.
@word = Word.create :word => 'bed'
After that I test to see if on a page I can find that row. Further I test if create action is working:
visit keywords_path
fill_in 'Word', :with => 'work'
click_button 'Create Word'
current_path.should == word_path(@word)
page.should have_content 'work'
And I get this failing test
creates a new word
Failure/Error: current_path.should == word_path(@word)
expected: "/words/1"
got: "/words/2" (using ==)
I understand where is the problem, but how can I check the path against the new created row?