Capybara 似乎没有在我的网页上看到按钮。这里有我的测试代码
before(:each) do
@inspiring = PostMotivation.create(:title => "This is title",:body => "body main content",:short => "short content of this post",:date => "20.06.2014")
end
it "should redirect when you want to add new comment" do
visit "/inspiring"
click_button("add_comment")
end
在这里你可以看到我的观点:
<%= button_to new_main_dupa_path(0,0,@post_to_render3.id), class: "button",id: "add_comment" do %>
Add new comment!
<% end %>
错误是:
2) Testing inspiring subpage with integration tests should redirect when you want to add new comment
Failure/Error: click_button("add_comment")
Capybara::ElementNotFound:
Unable to find button "add_comment"
# ./spec/features/inspiring.rb:39:in `block (2 levels) in <top (required)>'
如何让水豚看到这个按钮?我只是找不到解决这个问题的方法,在此先感谢。