Commit 47e5f1891b19e98ee20f0df55cb97fb70365562c
Committed by
Braulio Bhavamitra
1 parent
75a9f601
Exists in
master
and in
21 other branches
Fix cucumber tests for CreateCommunityTask
Showing
3 changed files
with
28 additions
and
15 deletions
Show diff stats
app/models/create_community.rb
features/create_community.feature
| ... | ... | @@ -39,44 +39,47 @@ Feature: create community |
| 39 | 39 | Then I should see "Creating new community" |
| 40 | 40 | |
| 41 | 41 | Scenario: environment admin receive a task when a user creates a community |
| 42 | - Given I am logged in as admin | |
| 42 | + Given I am logged in as "joaosilva" | |
| 43 | 43 | And feature "admin_must_approve_new_communities" is enabled on environment |
| 44 | - When I create community "Community for approval" | |
| 44 | + Given "joaosilva" creates the community "Community for approval" | |
| 45 | + Given I am logged in as admin | |
| 45 | 46 | And I go to admin_user's control panel |
| 46 | - Then I should see "admin_user wants to create community Community for approval" | |
| 47 | + Then I should see "Joao Silva wants to create community Community for approval" | |
| 47 | 48 | |
| 48 | 49 | Scenario: environment admin accepts new community task |
| 49 | - Given I am logged in as admin | |
| 50 | + Given I am logged in as "joaosilva" | |
| 50 | 51 | And feature "admin_must_approve_new_communities" is enabled on environment |
| 51 | - When I create community "Community for approval" | |
| 52 | + Given "joaosilva" creates the community "Community for approval" | |
| 53 | + Given I am logged in as admin | |
| 52 | 54 | And I go to admin_user's control panel |
| 53 | 55 | And I follow "Process requests" |
| 54 | - And I should see "admin_user wants to create community Community for approval" | |
| 56 | + And I should see "Joao Silva wants to create community Community for approval" | |
| 55 | 57 | And I choose "Accept" |
| 56 | 58 | When I press "Apply!" |
| 57 | - Then I should not see "admin_user wants to create community Community for approval" | |
| 58 | - And I go to admin_user's control panel | |
| 59 | + Then I should not see "Joao Silva wants to create community Community for approval" | |
| 60 | + And I go to joaosilva's control panel | |
| 59 | 61 | And I follow "Manage my groups" |
| 60 | 62 | Then I should see "Community for approval" |
| 61 | 63 | |
| 62 | 64 | Scenario: environment admin rejects new community task |
| 63 | - Given I am logged in as admin | |
| 65 | + Given I am logged in as "joaosilva" | |
| 64 | 66 | And feature "admin_must_approve_new_communities" is enabled on environment |
| 65 | - When I create community "Community for approval" | |
| 67 | + Given "joaosilva" creates the community "Community for approval" | |
| 68 | + Given I am logged in as admin | |
| 66 | 69 | And I go to admin_user's control panel |
| 67 | 70 | And I follow "Process requests" |
| 68 | - And I should see "admin_user wants to create community Community for approval" | |
| 71 | + And I should see "Joao Silva wants to create community Community for approval" | |
| 69 | 72 | And I choose "Reject" |
| 70 | 73 | When I press "Apply!" |
| 71 | - Then I should not see "admin_user wants to create community Community for approval" | |
| 72 | - And I go to admin_user's control panel | |
| 74 | + Then I should not see "Joao Silva wants to create community Community for approval" | |
| 75 | + And I go to joaosilva's control panel | |
| 73 | 76 | And I follow "Manage my groups" |
| 74 | 77 | Then I should not see "Community for approval" |
| 75 | 78 | |
| 76 | 79 | Scenario: new community is listed after approval |
| 77 | 80 | Given I am logged in as admin |
| 78 | 81 | And feature "admin_must_approve_new_communities" is enabled on environment |
| 79 | - When I create community "Community for approval" | |
| 82 | + Given "admin_user" creates the community "Community for approval" | |
| 80 | 83 | And I approve community "Community for approval" |
| 81 | 84 | And I go to admin_user's control panel |
| 82 | 85 | And I follow "Manage my groups" |
| ... | ... | @@ -85,8 +88,9 @@ Feature: create community |
| 85 | 88 | Scenario: new community is not listed after rejection |
| 86 | 89 | Given I am logged in as admin |
| 87 | 90 | And feature "admin_must_approve_new_communities" is enabled on environment |
| 88 | - When I create community "Community for approval" | |
| 91 | + Given "admin_user" creates the community "Community for approval" | |
| 89 | 92 | And I reject community "Community for approval" |
| 90 | 93 | And I go to admin_user's control panel |
| 91 | 94 | And I follow "Manage my groups" |
| 92 | 95 | Then I should not see "Community for approval" |
| 96 | + | ... | ... |
features/step_definitions/create_community_steps.rb
| ... | ... | @@ -8,6 +8,14 @@ Given /^I create community "(.+)"$/ do |community| |
| 8 | 8 | click_button("Create") |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | +Given /^"(.+)" creates the community "(.+)"$/ do |username, community| | |
| 12 | + When %{I go to #{username}'s control panel} | |
| 13 | + click_link('Manage my groups') | |
| 14 | + click_link('Create a new community') | |
| 15 | + fill_in("Name", :with => community) | |
| 16 | + click_button("Create") | |
| 17 | +end | |
| 18 | + | |
| 11 | 19 | Given /^I approve community "(.+)"$/ do |community| |
| 12 | 20 | task = CreateCommunity.all.select {|c| c.name == community}.first |
| 13 | 21 | Given %{I go to admin_user's control panel} | ... | ... |