From 77432ffc414b3d66db5c092eb587d07dff553a03 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Fri, 12 Jun 2015 03:10:37 +0800 Subject: [PATCH] Payment Method feature specs work with new enteprise user enterprise index --- spec/features/admin/payment_method_spec.rb | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/spec/features/admin/payment_method_spec.rb b/spec/features/admin/payment_method_spec.rb index 36fe344930..aa7caa2e0b 100644 --- a/spec/features/admin/payment_method_spec.rb +++ b/spec/features/admin/payment_method_spec.rb @@ -20,12 +20,12 @@ feature %q{ click_link 'New Payment Method' fill_in 'payment_method_name', :with => 'Cheque payment method' - + check "payment_method_distributor_ids_#{@distributors[0].id}" click_button 'Create' flash_message.should == 'Payment Method has been successfully created!' - + payment_method = Spree::PaymentMethod.find_by_name('Cheque payment method') payment_method.distributors.should == [@distributors[0]] end @@ -53,7 +53,7 @@ feature %q{ end end - context "as an enterprise user" do + context "as an enterprise user", js: true do let(:enterprise_user) { create_enterprise_user } let(:distributor1) { create(:distributor_enterprise, name: 'First Distributor') } let(:distributor2) { create(:distributor_enterprise, name: 'Second Distributor') } @@ -70,8 +70,11 @@ feature %q{ it "I can get to the new enterprise page" do click_link 'Enterprises' - within(".enterprise-#{distributor1.id}") { click_link 'Payment Methods' } - click_link 'New Payment Method' + within("#e_#{distributor1.id}") { click_link 'Manage' } + within(".side_menu") do + click_link "Payment Methods" + end + click_link 'Create One Now' current_path.should == spree.new_admin_payment_method_path end @@ -109,17 +112,25 @@ feature %q{ end - it "shows me only payment methods for the enterprise I select" do + pending "shows me only payment methods for the enterprise I select" do pm1 pm2 click_link 'Enterprises' - within(".enterprise-#{distributor1.id}") { click_link 'Payment Methods' } + within("#e_#{distributor1.id}") { click_link 'Manage' } + within(".side_menu") do + click_link "Payment Methods" + end + page.should have_content pm1.name page.should have_content pm2.name click_link 'Enterprises' - within(".enterprise-#{distributor2.id}") { click_link 'Payment Methods' } + within("#e_#{distributor2.id}") { click_link 'Manage' } + within(".side_menu") do + click_link "Payment Methods" + end + page.should_not have_content pm1.name page.should have_content pm2.name end