Payment Method feature specs work with new enteprise user enterprise index

This commit is contained in:
Rob Harrington
2015-06-12 03:10:37 +08:00
parent 5d2b36c667
commit 77432ffc41

View File

@@ -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