Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这些测试步骤。app_host 指向“google.com”。
Given /^I am on google\.com$/ do visit("/") end Then /^I should see something$/ do has_css?('a#something') end
无论我在第二步中有什么,测试都通过了。我只是想知道我是否在这里遗漏了什么。
只有当断言失败时,黄瓜步骤才会失败。它们不会根据最后一行是真还是假而失败。
要has_css?在断言中使用,您可以执行以下操作之一:
has_css?
#If you are using RSpec assertions page.should have_css('a#something') #If you are using Test::Unit assertions assert page.has_css?('a#something')