From 310b9766737a35edf8006d65e34ea618bab24078 Mon Sep 17 00:00:00 2001 From: dlinch Date: Mon, 16 Oct 2017 21:22:58 -0600 Subject: [PATCH] added feature_spec_helper to turn on javascript driver, added test for pledge button opening up a new tab --- spec/features/browsing_spec.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/features/browsing_spec.rb b/spec/features/browsing_spec.rb index 24cd9a5..964acfb 100644 --- a/spec/features/browsing_spec.rb +++ b/spec/features/browsing_spec.rb @@ -1,4 +1,4 @@ -require "rails_helper" +require "features_helper" require "support/omniauth" feature "Browsing the site:" do @@ -24,7 +24,7 @@ context "when there are wishlist items" do before do - create(:item, :on_a_wishlist, wishlist: dc_general, name: "BatCorgi!") + create(:item, :on_a_wishlist, wishlist: dc_general, name: "BatCorgi!", amazon_url: "https://www.amazon.com") create(:item, :on_a_wishlist, wishlist: st_josephs, name: "Puzzles") end @@ -36,6 +36,17 @@ expect(page).to have_button "Pledge to Donate" end + scenario "I can open a new tab to pledge", js: true do + visit "/" + + expect(page).to have_text "BatCorgi!" + + new_window = window_opened_by { all('input[value="Pledge to Donate"]').first.click } + new_window.close + + expect(page).to have_text "Pledge was successfully created." + end + scenario "I can see a list of items for a given wishlist" do visit "/" click_link "DC General"