0
我想在rspec中測試一個ajax請求,但是我不太清楚如何在這一點上做到這一點無關緊要,如果它是rspec或水豚,我只是試圖讓測試通過,任何建議是極大的讚賞如何使用rspec來測試Ajax請求?
describe "Cart", js: true, search: true do
let(:product) { create(:product) }
let(:variant) { create(:variant, :product => product, :count_on_hand => 1, :sku=>"YIG01276") }
let(:flash_sale) { create(:flash_sale) }
let(:user) { create(:user) }
before do
flash_sale.variants << variant
flash_sale.save
product.reload
end
it "displays expiring time in cart" do
login_user user
visit spree.product_path(product)
click_button 'Add To Cart'
user.last_incomplete_spree_order.expires_in.should > 0
end
end
可能重複RSpec的/回報率?](http://stackoverflow.com/questions/3971268/how-do-you-test-an-ajax-request-with-rspec-ror) –