Verifying page title with rspec

后端 未结 4 1043
孤街浪徒
孤街浪徒 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:21

    I found it easier to move to Capybara (I'm using Rails 3.0.1, Rspec 2.0.1, Ruby 1.9.2). Now you can do something like

    page.should have_css('title', :text => 'Ruby on Rails Tutorial Sample App | Home')
    

提交回复
热议问题