1
我試圖創建一個簡單的rspec,檢查一個Bootstrap導航欄和它內部的相應鏈接。我在spec_helper.rb
中包含了capybara/rspec
,並且在spec/features
目錄中有rspec,所以我認爲我的設置正確,但運行該規範會產生錯誤,指出內部方法未定義。使用水豚和rspec未定義的方法'內'
require 'spec_helper'
feature "HomePage" do
before { visit root_path }
subject { page }
describe "the navigation bar" do
it { should have_selector('.navbar') }
within ".navbar" do
it { should have_link('Game Contest Server', href: root_path) }
it { should have_link('Users', href: users_path) }
it { should have_link('Sign Up', href: signup_path) }
end
end
end
任何想法如何解決這個問題?