【发布时间】:2012-11-14 17:55:17
【问题描述】:
我正在尝试通过填写购买表格来测试请求规范中的订单流程:
describe "CC order" do
before do
visit order_path "product"
fill_in "full_name", with: "test name"
fill_in "email", with: "test@email.com"
fill_in "card_number", with: "4242424242424242"
fill_in "card_cvc", with: "123"
# etc...
click_on "complete-button"
end
it "should display confirmation message" do
page.should have_content "Thanks for your order!"
end
end
在提交购买表单并在开发中正确保存后,应保存新的用户和订单。但是,我的测试失败了,因为它没有处理订单,而是告诉我数据库已锁定:
我确实打开了事务性装置,并且我的一些其他测试使用了它们。还有其他方法可以测试我的订单流程吗?
编辑:当我在 it 块中使用 page 时,它似乎打开了。如果我只是让测试块为空,一切正常。
【问题讨论】:
-
有一次这种情况发生在我身上,结果我在另一个终端会话中运行相同的测试套件。哎呀。
-
好像不是这样 -
ps | grep ruby也没有显示任何其他内容。奇怪。
标签: ruby-on-rails ruby-on-rails-3.1 rspec integration-testing