Verifying page title with rspec

后端 未结 4 1073
孤街浪徒
孤街浪徒 2021-01-05 00:05

I\'m running through Michael Hartl\'s Rails Tutorial.

I\'m trying to verify the title of my page. The test looks like this:

it \"should have the rig         


        
4条回答
  •  死守一世寂寞
    2021-01-05 00:29

    This question looks old, which explains why there is now a better way.

    The following works well for me:

    it "has the correct page title", js: true do
      visit "/users/sign_in" # for example
      expect(page.title).to include "Sign In or Create a New Account"
    end
    

提交回复
热议问题