Commit 68de20e0b3b6d7789adf449415d112cb240e8be8

Authored by Daniel Cunha
1 parent 98ea732b

create_community.feature

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