ruby on rails - how can I use rspec to test an Ajax request? -


i trying test ajax request in rspec, not quite sure how @ point doesnt matter if rspec or capybara, trying test pass, advice appreciated

describe "cart", js: true, search: true    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     flash_sale.variants << variant     flash_sale.save     product.reload   end   "displays expiring time in cart"       login_user user      visit spree.product_path(product)      click_button 'add cart'      user.last_incomplete_spree_order.expires_in.should > 0     end   end 

if want check behavior after ajax call, update view. need use capybara https://github.com/jnicklas/capybara driver support javascript, selenium, webkit

if want test request, can use rack-test directly


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -