【发布时间】:2012-08-07 22:50:52
【问题描述】:
我有以下测试在 Rack::Test 中有效,但不使用 Selenium。 IE。如果我将, js: true 添加到describe 块中,我会在Firefox 中收到一条错误消息,指出它couldn't find the License with id=(@l 的id)
describe "should hide allocation rule # for pdf & clickthrough licenses" do
it "reads current state and shows/hides fields appropriately" do
@l = FactoryGirl.create(:license:,
way: License::CLICK_WAY)
visit edit_admin_license_path(@l)
end
end
为什么?我一定错过了一些东西。我可以使用 Sequel Pro 验证在使用 js: true 时记录没有被保存。
我需要这个规范在 Selenium 中运行,因为我要测试 javascript。
【问题讨论】:
-
尝试检查
log/test.log并确认正在执行正确的操作。您还可以在visit之后添加save_and_open_page以在浏览器中显示页面。 -
可能与您的数据库策略有关,您能否包括
spec_helper.rb?
标签: ruby selenium rspec capybara activeadmin