Try to page.reset! if the page is not reloaded in Capybara

testcapybararails
tomoyukikashiro
tomoyukikashiro

Outline

Do you have experience Capybara (feature test tool in gem not animal) dose not reload the page when you access same url more than once.
Try to use page.reset!

Solution

escribe "test" do

  it "the page title is user name" do
    user = Fabricate.create(:user)
    visit "/"
    expect(page).to have_title(user.name)

    user.update_attributes(name: "hoge")
    page.reset! # try to reset
    visit "/"
    expect(page).to have_title("hoge") # will success
  end

end