diff --git a/spec/features/admin/enterprise_roles_spec.rb b/spec/features/admin/enterprise_roles_spec.rb index ae83bae5ea..d9a12820b4 100644 --- a/spec/features/admin/enterprise_roles_spec.rb +++ b/spec/features/admin/enterprise_roles_spec.rb @@ -98,8 +98,7 @@ feature %q{ before do click_link 'Enterprises' click_link 'Test Enterprise' - within('.side_menu') { click_link 'Users' } - expect(page).to have_selector "table.managers" + navigate_to_enterprise_users end it "lists managers and shows icons for owner, contact, and email confirmation" do @@ -131,7 +130,7 @@ feature %q{ it "shows changes to enterprise contact or owner" do select2_select user2.email, from: 'receives_notifications_dropdown' within('#save-bar') { click_button 'Update' } - within('.side_menu') { click_link 'Users' } + navigate_to_enterprise_users within 'table.managers' do within "tr#manager-#{user1.id}" do @@ -156,6 +155,9 @@ feature %q{ click_button I18n.t('js.admin.modals.close') end + expect(page).not_to have_selector "#invite-manager-modal" + expect(page).to have_selector "table.managers" + new_user = Spree::User.find_by_email_and_confirmed_at(new_email, nil) expect(Enterprise.managed_by(new_user)).to include enterprise @@ -170,9 +172,16 @@ feature %q{ end end - private + def navigate_to_enterprise_users + within ".side_menu" do + click_link "Users" + end + + expect(page).to have_selector "table.managers" + end + def have_relationship(user, enterprise) have_table_row [user.email, 'manages', enterprise.name, ''] end