Commit 68de20e0b3b6d7789adf449415d112cb240e8be8

Authored by Daniel Cunha
1 parent 98ea732b

create_community.feature

features/create_community.feature
@@ -11,7 +11,7 @@ Feature: create community @@ -11,7 +11,7 @@ Feature: create community
11 Scenario: a user creates a community 11 Scenario: a user creates a community
12 Given I am logged in as "joaosilva" 12 Given I am logged in as "joaosilva"
13 And feature "admin_must_approve_new_communities" is disabled on environment 13 And feature "admin_must_approve_new_communities" is disabled on environment
14 - And I go to the Control panel 14 + And I go to joaosilva's control panel
15 And I follow "Manage my groups" 15 And I follow "Manage my groups"
16 When I follow "Create a new community" 16 When I follow "Create a new community"
17 And I fill in "Name" with "Fancy community" 17 And I fill in "Name" with "Fancy community"
@@ -22,7 +22,7 @@ Feature: create community @@ -22,7 +22,7 @@ Feature: create community
22 Scenario: a user creates a community when environment moderates it 22 Scenario: a user creates a community when environment moderates it
23 Given I am logged in as "joaosilva" 23 Given I am logged in as "joaosilva"
24 And feature "admin_must_approve_new_communities" is enabled on environment 24 And feature "admin_must_approve_new_communities" is enabled on environment
25 - When I go to the Control panel 25 + And I go to joaosilva's control panel
26 And I follow "Manage my groups" 26 And I follow "Manage my groups"
27 And I follow "Create a new community" 27 And I follow "Create a new community"
28 And I fill in "Name" with "Community for moderation" 28 And I fill in "Name" with "Community for moderation"
@@ -32,7 +32,7 @@ Feature: create community @@ -32,7 +32,7 @@ Feature: create community
32 Scenario: a user tries to create a community without a name 32 Scenario: a user tries to create a community without a name
33 Given I am logged in as "joaosilva" 33 Given I am logged in as "joaosilva"
34 And feature "admin_must_approve_new_communities" is disabled on environment 34 And feature "admin_must_approve_new_communities" is disabled on environment
35 - And I go to the Control panel 35 + And I go to joaosilva's control panel
36 And I follow "Manage my groups" 36 And I follow "Manage my groups"
37 When I follow "Create a new community" 37 When I follow "Create a new community"
38 And I press "Create" 38 And I press "Create"
@@ -42,20 +42,20 @@ Feature: create community @@ -42,20 +42,20 @@ Feature: create community
42 Given I am logged in as admin 42 Given I am logged in as admin
43 And feature "admin_must_approve_new_communities" is enabled on environment 43 And feature "admin_must_approve_new_communities" is enabled on environment
44 When I create community "Community for approval" 44 When I create community "Community for approval"
45 - And I go to the Control panel 45 + And I go to admin_user's control panel
46 Then I should see "admin_user wants to create community Community for approval" 46 Then I should see "admin_user wants to create community Community for approval"
47 47
48 Scenario: environment admin accepts new community task 48 Scenario: environment admin accepts new community task
49 Given I am logged in as admin 49 Given I am logged in as admin
50 And feature "admin_must_approve_new_communities" is enabled on environment 50 And feature "admin_must_approve_new_communities" is enabled on environment
51 When I create community "Community for approval" 51 When I create community "Community for approval"
52 - And I go to the Control panel 52 + And I go to admin_user's control panel
53 And I follow "Process requests" 53 And I follow "Process requests"
54 And I should see "admin_user wants to create community Community for approval" 54 And I should see "admin_user wants to create community Community for approval"
55 And I choose "Accept" 55 And I choose "Accept"
56 When I press "Apply!" 56 When I press "Apply!"
57 Then I should not see "admin_user wants to create community Community for approval" 57 Then I should not see "admin_user wants to create community Community for approval"
58 - When I go to the Control panel 58 + And I go to admin_user's control panel
59 And I follow "Manage my groups" 59 And I follow "Manage my groups"
60 Then I should see "Community for approval" 60 Then I should see "Community for approval"
61 61
@@ -63,13 +63,13 @@ Feature: create community @@ -63,13 +63,13 @@ Feature: create community
63 Given I am logged in as admin 63 Given I am logged in as admin
64 And feature "admin_must_approve_new_communities" is enabled on environment 64 And feature "admin_must_approve_new_communities" is enabled on environment
65 When I create community "Community for approval" 65 When I create community "Community for approval"
66 - And I go to the Control panel 66 + And I go to admin_user's control panel
67 And I follow "Process requests" 67 And I follow "Process requests"
68 And I should see "admin_user wants to create community Community for approval" 68 And I should see "admin_user wants to create community Community for approval"
69 And I choose "Reject" 69 And I choose "Reject"
70 When I press "Apply!" 70 When I press "Apply!"
71 Then I should not see "admin_user wants to create community Community for approval" 71 Then I should not see "admin_user wants to create community Community for approval"
72 - When I go to the Control panel 72 + And I go to admin_user's control panel
73 And I follow "Manage my groups" 73 And I follow "Manage my groups"
74 Then I should not see "Community for approval" 74 Then I should not see "Community for approval"
75 75
@@ -78,7 +78,7 @@ Feature: create community @@ -78,7 +78,7 @@ Feature: create community
78 And feature "admin_must_approve_new_communities" is enabled on environment 78 And feature "admin_must_approve_new_communities" is enabled on environment
79 When I create community "Community for approval" 79 When I create community "Community for approval"
80 And I approve community "Community for approval" 80 And I approve community "Community for approval"
81 - When I go to the Control panel 81 + And I go to admin_user's control panel
82 And I follow "Manage my groups" 82 And I follow "Manage my groups"
83 Then I should see "Community for approval" 83 Then I should see "Community for approval"
84 84
@@ -87,6 +87,6 @@ Feature: create community @@ -87,6 +87,6 @@ Feature: create community
87 And feature "admin_must_approve_new_communities" is enabled on environment 87 And feature "admin_must_approve_new_communities" is enabled on environment
88 When I create community "Community for approval" 88 When I create community "Community for approval"
89 And I reject community "Community for approval" 89 And I reject community "Community for approval"
90 - When I go to the Control panel 90 + And I go to admin_user's control panel
91 And I follow "Manage my groups" 91 And I follow "Manage my groups"
92 Then I should not see "Community for approval" 92 Then I should not see "Community for approval"
features/step_definitions/create_community_steps.rb
1 include DatesHelper 1 include DatesHelper
2 2
3 Given /^I create community "(.+)"$/ do |community| 3 Given /^I create community "(.+)"$/ do |community|
4 - Given 'I go to the Control panel' 4 + Given %{I go to admin_user's control panel}
5 click_link('Manage my groups') 5 click_link('Manage my groups')
6 click_link('Create a new community') 6 click_link('Create a new community')
7 fill_in("Name", :with => community) 7 fill_in("Name", :with => community)
@@ -10,7 +10,7 @@ end @@ -10,7 +10,7 @@ end
10 10
11 Given /^I approve community "(.+)"$/ do |community| 11 Given /^I approve community "(.+)"$/ do |community|
12 task = CreateCommunity.all.select {|c| c.name == community}.first 12 task = CreateCommunity.all.select {|c| c.name == community}.first
13 - Given 'I go to the Control panel' 13 + Given %{I go to admin_user's control panel}
14 click_link('Process requests') 14 click_link('Process requests')
15 choose("decision-finish-#{task.id}") 15 choose("decision-finish-#{task.id}")
16 click_button('Apply!') 16 click_button('Apply!')
@@ -18,7 +18,7 @@ end @@ -18,7 +18,7 @@ end
18 18
19 Given /^I reject community "(.+)"$/ do |community| 19 Given /^I reject community "(.+)"$/ do |community|
20 task = CreateCommunity.all.select {|c| c.name == community}.first 20 task = CreateCommunity.all.select {|c| c.name == community}.first
21 - Given 'I go to the Control panel' 21 + Given %{I go to admin_user's control panel}
22 click_link('Process requests') 22 click_link('Process requests')
23 choose("decision-cancel-#{task.id}") 23 choose("decision-cancel-#{task.id}")
24 click_button('Apply!') 24 click_button('Apply!')
@@ -27,5 +27,5 @@ end @@ -27,5 +27,5 @@ end
27 Then /^I should see "([^\"]*)"'s creation date$/ do |community| 27 Then /^I should see "([^\"]*)"'s creation date$/ do |community|
28 com = Community.find_by_name community 28 com = Community.find_by_name community
29 text = "Created at: #{show_date(com.created_at)}" 29 text = "Created at: #{show_date(com.created_at)}"
30 - response.should contain(text) 30 + has_content?(text)
31 end 31 end
features/support/paths.rb
@@ -72,9 +72,6 @@ module NavigationHelpers @@ -72,9 +72,6 @@ module NavigationHelpers
72 when /^(.*)'s control panel$/ 72 when /^(.*)'s control panel$/
73 '/myprofile/' + $1 73 '/myprofile/' + $1
74 74
75 - when /^the Control panel$/  
76 - '/myprofile/%s' % User.find_by_id(session[:user]).login  
77 -  
78 when /the environment control panel/ 75 when /the environment control panel/
79 '/admin' 76 '/admin'
80 77