I am testing with RSpec+capybara, but i've got the error:
Failure/Error: page.should have_selector('title', :text => "YourPos | About")
expected #has_selector?("title", {:text=>"YourPos | About"}) to return true, got false
# ./spec/requests/static_pages_spec.rb:14:in `block (3 levels) in <top (required)>'
And my static_pages_spec.rb
require 'spec_helper'
describe "Static pages" do
describe "About page" do
it "should have the title 'About' " do
visit '/static_pages/about'
page.should have_selector('title', :text => "YourPos | About")
end
end
end
And my app/views/static_pages/about.html.erb
<!DOCTYPE html>
<html>
<head>
<title>YourPos | About</title>
</head>
<body>
<p>Find me in app/views/static_pages/home.html.erb</p>
</body>
</html>
Wish someone will help me, Thanks a lot.
Try changing
visit 'static_pages/about'
to
visit '/static_pages/about'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.