更新しました:
「RackTestドライバーは、フォーム内にないボタンをクリックすることはできません。」jnicklasによる
参照:https ://groups.google.com/forum/?fromgroups =#!topic / ruby-capybara / ECc4U_dux08
元:
私はこの問題に何時間も苦労してきましたが、その理由を理解できません。手伝っていただけませんか?
index.html.haml
.welcome.ac
%h1.brand.text-info GroupMeal
%h2.tagline
The simplest way of scheduling meals with your groups and friends
%p
- if !current_user
%button#fblogin.btn.btn-info.btn-large Login with Facebook
- else
%a.btn.btn-info.btn-large{:href => '/signout'} Sign out\
authentications_spec.rb
describe "page" do
before do
visit root_path
end
it { should have_button('Login with Facebook') } # 1. This case is passed
describe "with valid information" do
before do
click_button('Login with Facebook') # 2. But this line is broken
end
it { should have_link('Sign out', href: '/signout') }
end
end
ケース1:「Facebookでログイン」ボタンが存在することを確認します->合格。
ケース2:click_button->失敗し、以下のエラーを受け取ります。
Failure/Error: click_button('Login with Facebook')
NoMethodError:
undefined method `node_name' for nil:NilClass
ボタンが存在する理由がわかりませんが、クリックできません。