From 7e4258777f8eed31cfe202bb96178823218f3b1c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 8 Mar 2015 20:52:22 -0700 Subject: Move Profile groups tests to Dashboard group tests --- features/dashboard/group.feature | 48 +++++++++++++++++++++++++++++++++++++++ features/profile/group.feature | 48 --------------------------------------- features/steps/dashboard/group.rb | 44 +++++++++++++++++++++++++++++++++++ features/steps/profile/group.rb | 44 ----------------------------------- features/steps/shared/paths.rb | 16 ++++++------- 5 files changed, 100 insertions(+), 100 deletions(-) create mode 100644 features/dashboard/group.feature delete mode 100644 features/profile/group.feature create mode 100644 features/steps/dashboard/group.rb delete mode 100644 features/steps/profile/group.rb (limited to 'features') diff --git a/features/dashboard/group.feature b/features/dashboard/group.feature new file mode 100644 index 00000000000..0e4acb325b7 --- /dev/null +++ b/features/dashboard/group.feature @@ -0,0 +1,48 @@ +@dashboard +Feature: Profile Group + Background: + Given I sign in as "John Doe" + And "John Doe" is owner of group "Owned" + And "John Doe" is guest of group "Guest" + + # Leave groups + + @javascript + Scenario: Owner should be able to leave from group if he is not the last owner + Given "Mary Jane" is owner of group "Owned" + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should see group "Guest" in group list + When I click on the "Leave" button for group "Owned" + And I visit dashboard groups page + Then I should not see group "Owned" in group list + Then I should see group "Guest" in group list + + @javascript + Scenario: Owner should not be able to leave from group if he is the last owner + Given "Mary Jane" is guest of group "Owned" + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should see group "Guest" in group list + Then I should not see the "Leave" button for group "Owned" + + @javascript + Scenario: Guest should be able to leave from group + Given "Mary Jane" is guest of group "Guest" + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should see group "Guest" in group list + When I click on the "Leave" button for group "Guest" + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should not see group "Guest" in group list + + @javascript + Scenario: Guest should be able to leave from group even if he is the only user in the group + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should see group "Guest" in group list + When I click on the "Leave" button for group "Guest" + When I visit dashboard groups page + Then I should see group "Owned" in group list + Then I should not see group "Guest" in group list diff --git a/features/profile/group.feature b/features/profile/group.feature deleted file mode 100644 index e2fbfde77be..00000000000 --- a/features/profile/group.feature +++ /dev/null @@ -1,48 +0,0 @@ -@profile -Feature: Profile Group - Background: - Given I sign in as "John Doe" - And "John Doe" is owner of group "Owned" - And "John Doe" is guest of group "Guest" - - # Leave groups - - @javascript - Scenario: Owner should be able to leave from group if he is not the last owner - Given "Mary Jane" is owner of group "Owned" - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should see group "Guest" in group list - When I click on the "Leave" button for group "Owned" - And I visit profile groups page - Then I should not see group "Owned" in group list - Then I should see group "Guest" in group list - - @javascript - Scenario: Owner should not be able to leave from group if he is the last owner - Given "Mary Jane" is guest of group "Owned" - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should see group "Guest" in group list - Then I should not see the "Leave" button for group "Owned" - - @javascript - Scenario: Guest should be able to leave from group - Given "Mary Jane" is guest of group "Guest" - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should see group "Guest" in group list - When I click on the "Leave" button for group "Guest" - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should not see group "Guest" in group list - - @javascript - Scenario: Guest should be able to leave from group even if he is the only user in the group - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should see group "Guest" in group list - When I click on the "Leave" button for group "Guest" - When I visit profile groups page - Then I should see group "Owned" in group list - Then I should not see group "Guest" in group list diff --git a/features/steps/dashboard/group.rb b/features/steps/dashboard/group.rb new file mode 100644 index 00000000000..09d7717b67b --- /dev/null +++ b/features/steps/dashboard/group.rb @@ -0,0 +1,44 @@ +class Spinach::Features::DashboardGroup < Spinach::FeatureSteps + include SharedAuthentication + include SharedGroup + include SharedPaths + include SharedUser + + # Leave + + step 'I click on the "Leave" button for group "Owned"' do + find(:css, 'li', text: "Owner").find(:css, 'i.fa.fa-sign-out').click + # poltergeist always confirms popups. + end + + step 'I click on the "Leave" button for group "Guest"' do + find(:css, 'li', text: "Guest").find(:css, 'i.fa.fa-sign-out').click + # poltergeist always confirms popups. + end + + step 'I should not see the "Leave" button for group "Owned"' do + find(:css, 'li', text: "Owner").should_not have_selector(:css, 'i.fa.fa-sign-out') + # poltergeist always confirms popups. + end + + step 'I should not see the "Leave" button for groupr "Guest"' do + find(:css, 'li', text: "Guest").should_not have_selector(:css, 'i.fa.fa-sign-out') + # poltergeist always confirms popups. + end + + step 'I should see group "Owned" in group list' do + page.should have_content("Owned") + end + + step 'I should not see group "Owned" in group list' do + page.should_not have_content("Owned") + end + + step 'I should see group "Guest" in group list' do + page.should have_content("Guest") + end + + step 'I should not see group "Guest" in group list' do + page.should_not have_content("Guest") + end +end diff --git a/features/steps/profile/group.rb b/features/steps/profile/group.rb deleted file mode 100644 index 0a10e04e219..00000000000 --- a/features/steps/profile/group.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Spinach::Features::ProfileGroup < Spinach::FeatureSteps - include SharedAuthentication - include SharedGroup - include SharedPaths - include SharedUser - - # Leave - - step 'I click on the "Leave" button for group "Owned"' do - find(:css, 'li', text: "Owner").find(:css, 'i.fa.fa-sign-out').click - # poltergeist always confirms popups. - end - - step 'I click on the "Leave" button for group "Guest"' do - find(:css, 'li', text: "Guest").find(:css, 'i.fa.fa-sign-out').click - # poltergeist always confirms popups. - end - - step 'I should not see the "Leave" button for group "Owned"' do - find(:css, 'li', text: "Owner").should_not have_selector(:css, 'i.fa.fa-sign-out') - # poltergeist always confirms popups. - end - - step 'I should not see the "Leave" button for groupr "Guest"' do - find(:css, 'li', text: "Guest").should_not have_selector(:css, 'i.fa.fa-sign-out') - # poltergeist always confirms popups. - end - - step 'I should see group "Owned" in group list' do - page.should have_content("Owned") - end - - step 'I should not see group "Owned" in group list' do - page.should_not have_content("Owned") - end - - step 'I should see group "Guest" in group list' do - page.should have_content("Guest") - end - - step 'I should not see group "Guest" in group list' do - page.should_not have_content("Guest") - end -end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 835b644e6c7..db6417bf951 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -87,6 +87,14 @@ module SharedPaths visit help_path end + step 'I visit dashboard groups page' do + visit dashboard_groups_path + end + + step 'I should be redirected to the dashboard groups page' do + current_path.should == dashboard_groups_path + end + # ---------------------------------------- # Profile # ---------------------------------------- @@ -119,14 +127,6 @@ module SharedPaths visit history_profile_path end - step 'I visit profile groups page' do - visit profile_groups_path - end - - step 'I should be redirected to the profile groups page' do - current_path.should == profile_groups_path - end - # ---------------------------------------- # Admin # ---------------------------------------- -- cgit v1.2.1