![](/img/trans.png)
[英]URI::InvalidURIError when performing Feature Tests in RSpec Capybara
[英]URI::InvalidURIError while i am testing with rspec+capybara
我正在使用RSpec + capybara進行測試,但出現錯誤:
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)>'
還有我的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
還有我的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>
希望有人能幫助我,非常感謝。
嘗試改變
visit 'static_pages/about'
至
visit '/static_pages/about'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.