saasy 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. data/CHANGELOG.md +114 -0
  2. data/Gemfile +26 -0
  3. data/README.md +118 -0
  4. data/Rakefile +38 -0
  5. data/app/controllers/accounts_controller.rb +68 -0
  6. data/app/controllers/billings_controller.rb +25 -0
  7. data/app/controllers/invitations_controller.rb +65 -0
  8. data/app/controllers/memberships_controller.rb +45 -0
  9. data/app/controllers/plans_controller.rb +24 -0
  10. data/app/controllers/profiles_controller.rb +19 -0
  11. data/app/helpers/limits_helper.rb +13 -0
  12. data/app/mailers/billing_mailer.rb +53 -0
  13. data/app/mailers/invitation_mailer.rb +18 -0
  14. data/app/models/invitation.rb +113 -0
  15. data/app/models/limit.rb +49 -0
  16. data/app/models/membership.rb +26 -0
  17. data/app/models/permission.rb +19 -0
  18. data/app/models/signup.rb +163 -0
  19. data/app/views/accounts/_account.html.erb +9 -0
  20. data/app/views/accounts/_blank_slate.html.erb +6 -0
  21. data/app/views/accounts/_projects.html.erb +12 -0
  22. data/app/views/accounts/_subnav.html.erb +10 -0
  23. data/app/views/accounts/edit.html.erb +34 -0
  24. data/app/views/accounts/index.html.erb +9 -0
  25. data/app/views/accounts/new.html.erb +36 -0
  26. data/app/views/billing_mailer/completed_trial.text.erb +13 -0
  27. data/app/views/billing_mailer/expiring_trial.text.erb +15 -0
  28. data/app/views/billing_mailer/new_unactivated.text.erb +1 -0
  29. data/app/views/billing_mailer/problem.html.erb +13 -0
  30. data/app/views/billing_mailer/problem.text.erb +14 -0
  31. data/app/views/billing_mailer/receipt.html.erb +41 -0
  32. data/app/views/billing_mailer/receipt.text.erb +25 -0
  33. data/app/views/billings/_form.html.erb +8 -0
  34. data/app/views/billings/edit.html.erb +13 -0
  35. data/app/views/billings/show.html.erb +29 -0
  36. data/app/views/invitation_mailer/invitation.text.erb +6 -0
  37. data/app/views/invitations/new.html.erb +17 -0
  38. data/app/views/invitations/show.html.erb +22 -0
  39. data/app/views/layouts/saucy.html.erb +36 -0
  40. data/app/views/limits/_meter.html.erb +13 -0
  41. data/app/views/memberships/edit.html.erb +21 -0
  42. data/app/views/memberships/index.html.erb +17 -0
  43. data/app/views/plans/_plan.html.erb +32 -0
  44. data/app/views/plans/_terms.html.erb +15 -0
  45. data/app/views/plans/edit.html.erb +33 -0
  46. data/app/views/plans/index.html.erb +12 -0
  47. data/app/views/profiles/_inputs.html.erb +5 -0
  48. data/app/views/profiles/edit.html.erb +36 -0
  49. data/app/views/projects/_form.html.erb +36 -0
  50. data/app/views/projects/edit.html.erb +22 -0
  51. data/app/views/projects/index.html.erb +28 -0
  52. data/app/views/projects/new.html.erb +13 -0
  53. data/app/views/projects/show.html.erb +0 -0
  54. data/app/views/shared/_project_dropdown.html.erb +55 -0
  55. data/app/views/shared/_saucy_javascript.html.erb +33 -0
  56. data/config/locales/en.yml +37 -0
  57. data/config/routes.rb +19 -0
  58. data/features/run_features.feature +83 -0
  59. data/features/step_definitions/clearance_steps.rb +45 -0
  60. data/features/step_definitions/rails_steps.rb +73 -0
  61. data/features/step_definitions/saucy_steps.rb +8 -0
  62. data/features/support/env.rb +4 -0
  63. data/features/support/file.rb +11 -0
  64. data/lib/generators/saucy/base.rb +18 -0
  65. data/lib/generators/saucy/features/features_generator.rb +91 -0
  66. data/lib/generators/saucy/features/templates/README +3 -0
  67. data/lib/generators/saucy/features/templates/factories.rb +71 -0
  68. data/lib/generators/saucy/features/templates/features/edit_profile.feature +9 -0
  69. data/lib/generators/saucy/features/templates/features/edit_project_permissions.feature +37 -0
  70. data/lib/generators/saucy/features/templates/features/edit_user_permissions.feature +47 -0
  71. data/lib/generators/saucy/features/templates/features/manage_account.feature +35 -0
  72. data/lib/generators/saucy/features/templates/features/manage_billing.feature +93 -0
  73. data/lib/generators/saucy/features/templates/features/manage_plan.feature +143 -0
  74. data/lib/generators/saucy/features/templates/features/manage_projects.feature +139 -0
  75. data/lib/generators/saucy/features/templates/features/manage_users.feature +142 -0
  76. data/lib/generators/saucy/features/templates/features/new_account.feature +33 -0
  77. data/lib/generators/saucy/features/templates/features/project_dropdown.feature +77 -0
  78. data/lib/generators/saucy/features/templates/features/sign_up.feature +32 -0
  79. data/lib/generators/saucy/features/templates/features/sign_up_paid.feature +65 -0
  80. data/lib/generators/saucy/features/templates/features/trial_plans.feature +82 -0
  81. data/lib/generators/saucy/features/templates/step_definitions/account_steps.rb +30 -0
  82. data/lib/generators/saucy/features/templates/step_definitions/braintree_steps.rb +25 -0
  83. data/lib/generators/saucy/features/templates/step_definitions/cron_steps.rb +23 -0
  84. data/lib/generators/saucy/features/templates/step_definitions/email_steps.rb +40 -0
  85. data/lib/generators/saucy/features/templates/step_definitions/factory_girl_steps.rb +1 -0
  86. data/lib/generators/saucy/features/templates/step_definitions/html_steps.rb +51 -0
  87. data/lib/generators/saucy/features/templates/step_definitions/plan_steps.rb +16 -0
  88. data/lib/generators/saucy/features/templates/step_definitions/project_steps.rb +4 -0
  89. data/lib/generators/saucy/features/templates/step_definitions/session_steps.rb +37 -0
  90. data/lib/generators/saucy/features/templates/step_definitions/user_steps.rb +100 -0
  91. data/lib/generators/saucy/features/templates/support/braintree.rb +5 -0
  92. data/lib/generators/saucy/install/install_generator.rb +40 -0
  93. data/lib/generators/saucy/install/templates/controllers/projects_controller.rb +3 -0
  94. data/lib/generators/saucy/install/templates/create_saucy_tables.rb +115 -0
  95. data/lib/generators/saucy/install/templates/models/account.rb +3 -0
  96. data/lib/generators/saucy/install/templates/models/plan.rb +3 -0
  97. data/lib/generators/saucy/install/templates/models/project.rb +3 -0
  98. data/lib/generators/saucy/specs/specs_generator.rb +20 -0
  99. data/lib/generators/saucy/specs/templates/support/braintree.rb +5 -0
  100. data/lib/generators/saucy/views/views_generator.rb +23 -0
  101. data/lib/saucy.rb +10 -0
  102. data/lib/saucy/account.rb +132 -0
  103. data/lib/saucy/account_authorization.rb +67 -0
  104. data/lib/saucy/configuration.rb +29 -0
  105. data/lib/saucy/engine.rb +35 -0
  106. data/lib/saucy/fake_braintree.rb +134 -0
  107. data/lib/saucy/layouts.rb +36 -0
  108. data/lib/saucy/plan.rb +54 -0
  109. data/lib/saucy/project.rb +125 -0
  110. data/lib/saucy/projects_controller.rb +94 -0
  111. data/lib/saucy/railties/tasks.rake +28 -0
  112. data/lib/saucy/routing_extensions.rb +121 -0
  113. data/lib/saucy/subscription.rb +237 -0
  114. data/lib/saucy/user.rb +30 -0
  115. data/spec/controllers/accounts_controller_spec.rb +228 -0
  116. data/spec/controllers/application_controller_spec.rb +32 -0
  117. data/spec/controllers/invitations_controller_spec.rb +215 -0
  118. data/spec/controllers/memberships_controller_spec.rb +117 -0
  119. data/spec/controllers/plans_controller_spec.rb +13 -0
  120. data/spec/controllers/profiles_controller_spec.rb +48 -0
  121. data/spec/controllers/projects_controller_spec.rb +216 -0
  122. data/spec/environment.rb +95 -0
  123. data/spec/layouts_spec.rb +21 -0
  124. data/spec/mailers/billing_mailer_spec.rb +68 -0
  125. data/spec/mailers/invitiation_mailer_spec.rb +19 -0
  126. data/spec/models/account_spec.rb +218 -0
  127. data/spec/models/invitation_spec.rb +320 -0
  128. data/spec/models/limit_spec.rb +70 -0
  129. data/spec/models/membership_spec.rb +37 -0
  130. data/spec/models/permission_spec.rb +30 -0
  131. data/spec/models/plan_spec.rb +81 -0
  132. data/spec/models/project_spec.rb +223 -0
  133. data/spec/models/signup_spec.rb +177 -0
  134. data/spec/models/subscription_spec.rb +481 -0
  135. data/spec/models/user_spec.rb +72 -0
  136. data/spec/route_extensions_spec.rb +51 -0
  137. data/spec/saucy_spec.rb +62 -0
  138. data/spec/scaffold/config/routes.rb +5 -0
  139. data/spec/spec_helper.rb +39 -0
  140. data/spec/support/authentication_helpers.rb +81 -0
  141. data/spec/support/authorization_helpers.rb +56 -0
  142. data/spec/support/braintree.rb +7 -0
  143. data/spec/support/clearance_matchers.rb +55 -0
  144. data/spec/support/notifications.rb +57 -0
  145. data/spec/views/accounts/_account.html.erb_spec.rb +37 -0
  146. metadata +325 -0
@@ -0,0 +1,93 @@
1
+ Feature: Manage Billing
2
+ As a admin user
3
+ I want to be able to manage my billing information
4
+ So that my account can stay up to date and in good standing
5
+
6
+ Scenario: Update the billing information on an account with a paid plan
7
+ Given a paid plan exists with a name of "Paid"
8
+ And the following account exists:
9
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
10
+ | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
11
+ And I have signed in with "joe@example.com/test"
12
+ And "joe@example.com" is an admin of the "Test" account
13
+ When I go to the billing page for the "Test" account
14
+ Then I should see "card ending in 5555"
15
+ And I should see "There have been no invoices yet."
16
+ And I follow "Change" within ".current_credit_card"
17
+
18
+ Then the "Cardholder name" field should contain "Joe Smith"
19
+ And the "Billing email" field should contain "jsmith@example.com"
20
+ And the "Card number" field should have nothing in it
21
+ And the "Verification code" field should have nothing in it
22
+ And the "Expiration month" field should contain "01"
23
+ And the "Expiration year" field should contain "2015"
24
+
25
+ And I fill in "Cardholder name" with "Ralph Robot"
26
+ And I fill in "Billing email" with "accounting@example.com"
27
+ And I fill in "Card number" with "4111111111111111"
28
+ And I fill in "Verification code" with "123"
29
+ And I select "March" from "Expiration month"
30
+ And I select "2020" from "Expiration year"
31
+ And I press "Update"
32
+ Then I should see "updated successfully"
33
+ Then I should see "card ending in 1111"
34
+
35
+ Scenario: Be forced to update the billing information on an account with a paid plan that is past due
36
+ Given a paid plan exists with a name of "Paid"
37
+ And the following account exists:
38
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
39
+ | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
40
+ And the "Test" account is past due
41
+ And I have signed in with "joe@example.com/test"
42
+ And "joe@example.com" is an admin of the "Test" account
43
+ When I go to the settings page for the "Test" account
44
+ Then I should be on the billing page for the "Test" account
45
+ And I should see "There was an issue processing the credit card you have on file. Please update your credit card information."
46
+
47
+ Scenario: Be told to have an admin update the billing information on an account with a paid plan that is past due
48
+ Given a paid plan exists with a name of "Paid"
49
+ And the following account exists:
50
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
51
+ | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
52
+ And the "Test" account is past due
53
+ And the following projects exist:
54
+ | name | account |
55
+ | Project | name: Test |
56
+ | Project2 | name: Test |
57
+ And the following user exists:
58
+ | email |
59
+ | jsmith@example.com |
60
+ And "jsmith@example.com" is a member of the "Project" project
61
+ And I sign in as "jsmith@example.com"
62
+ When I go to the accounts page
63
+ Then I should see "There was an issue processing the credit card on file for this account. Please have an administrator on the account update the credit card information."
64
+ Then I should be on the billing page for the "Test" account
65
+
66
+ Scenario: View past credit card charges
67
+ Given a paid plan exists with a name of "Paid"
68
+ And the following account exists:
69
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
70
+ | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
71
+ And the following transaction exist for the "Test" account:
72
+ | status | amount | created_at |
73
+ | Settled | 20.00 | July 1, 2010 |
74
+ | Settled | 5.00 | August 1, 2010 |
75
+ And I have signed in with "joe@example.com/test"
76
+ And "joe@example.com" is an admin of the "Test" account
77
+ When I go to the billing page for the "Test" account
78
+ Then I should see "Your Invoices"
79
+ And I should see "07/01/10 $20"
80
+ And I should see "08/01/10 $5"
81
+
82
+ Scenario: Navigate back to the main settings page
83
+ Given a paid plan exists with a name of "Paid"
84
+ And the following account exists:
85
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
86
+ | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
87
+ And I have signed in with "joe@example.com/test"
88
+ And "joe@example.com" is an admin of the "Test" account
89
+ When I go to the billing page for the "Test" account
90
+ And I follow "Change"
91
+ And I follow "Billing"
92
+ And I follow "Account Info"
93
+ Then I should be on the settings page for the "Test" account
@@ -0,0 +1,143 @@
1
+ Feature: Manage Plan
2
+ As a admin user
3
+ I want to be able to upgrade and downgrade my account
4
+ So that I can pay what I want and get the features I want
5
+
6
+ Scenario: Change the plan to another paid plan on an account with a paid plan
7
+ Given a paid plan exists with a name of "Basic"
8
+ And a paid plan exists with a name of "Premium"
9
+ And the following account exists:
10
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
11
+ | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
12
+ And I have signed in with "joe@example.com/test"
13
+ And "joe@example.com" is an admin of the "Test" account
14
+ When I go to the settings page for the "Test" account
15
+ Then I should see "Your Plan"
16
+ And I should not see "Billing Information"
17
+ And I should see "Basic"
18
+ And I follow "Upgrade"
19
+ Then I should see "Upgrade Your Plan"
20
+ When I choose the "Premium" plan
21
+ And I press "Upgrade"
22
+ Then I should see "Plan changed successfully"
23
+ Then I should see "Premium"
24
+
25
+ Scenario: Change the plan from free to paid
26
+ Given a plan exists with a name of "Free"
27
+ And a paid plan exists with a name of "Basic"
28
+ And the following account exists:
29
+ | name | keyword | plan |
30
+ | Test | test | name: Free |
31
+ And I have signed in with "joe@example.com/test"
32
+ And "joe@example.com" is an admin of the "Test" account
33
+ When I go to the settings page for the "Test" account
34
+ Then I should not see "Billing" within ".subnav"
35
+ Then I should see "Your Plan"
36
+ And I follow "Upgrade"
37
+ Then I should see "Upgrade Your Plan"
38
+ When I choose the "Basic" plan
39
+ Then I should see "Billing Information"
40
+ And I fill in "Cardholder name" with "Ralph Robot"
41
+ And I fill in "Billing email" with "accounting@example.com"
42
+ And I fill in "Card number" with "4111111111111111"
43
+ And I fill in "Verification code" with "123"
44
+ And I select "March" from "Expiration month"
45
+ And I select "2020" from "Expiration year"
46
+ When I press "Upgrade"
47
+ Then I should see "Plan changed successfully"
48
+ And I should see "Basic"
49
+ And I follow "Billing"
50
+ Then I should see "card ending in 1111"
51
+
52
+ Scenario: Change the plan from free to paid with an invalid credit card number
53
+ Given that the credit card "4111112" is invalid
54
+ And a plan exists with a name of "Free"
55
+ And a paid plan exists with a name of "Basic"
56
+ And the following account exists:
57
+ | name | keyword | plan |
58
+ | Test | test | name: Free |
59
+ And I have signed in with "joe@example.com/test"
60
+ And "joe@example.com" is an admin of the "Test" account
61
+ When I go to the settings page for the "Test" account
62
+ Then I should not see "Billing" within ".subnav"
63
+ Then I should see "Your Plan"
64
+ And I follow "Upgrade"
65
+ When I choose the "Basic" plan
66
+ Then I should see "Billing Information"
67
+ And I fill in "Cardholder name" with "Ralph Robot"
68
+ And I fill in "Billing email" with "accounting@example.com"
69
+ And I fill in "Card number" with "4111112"
70
+ And I fill in "Verification code" with "123"
71
+ And I select "March" from "Expiration month"
72
+ And I select "2020" from "Expiration year"
73
+ When I press "Upgrade"
74
+ Then I should not see "Plan changed successfully"
75
+ And "Card number" should have the error "is invalid"
76
+
77
+ Scenario: Change the plan to a free on an account with a paid plan
78
+ Given a paid plan exists with a name of "Basic"
79
+ And a plan exists with a name of "Free"
80
+ And the following account exists:
81
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
82
+ | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
83
+ And I have signed in with "joe@example.com/test"
84
+ And "joe@example.com" is an admin of the "Test" account
85
+ When I go to the settings page for the "Test" account
86
+ Then I should see "Your Plan"
87
+ And I should not see "Billing Information"
88
+ And I should see "Basic"
89
+ And I follow "Upgrade"
90
+ Then I should see "Upgrade Your Plan"
91
+ When I choose the "Free" plan
92
+ And I press "Upgrade"
93
+ Then I should see "Plan changed successfully"
94
+ Then I should see "Free"
95
+
96
+ Scenario: Attempting to downgrade when beyond the limits
97
+ Given a paid plan exists with a name of "Basic"
98
+ And a plan exists with a name of "Free"
99
+ And the following account exists:
100
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
101
+ | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
102
+ And the following limits exist:
103
+ | plan | name | value | value_type |
104
+ | name: Basic | users | 1 | number |
105
+ | name: Free | users | 0 | number |
106
+ | name: Basic | projects | 5 | number |
107
+ | name: Free | projects | 1 | number |
108
+ | name: Basic | ssl | 1 | boolean |
109
+ | name: Free | ssl | 0 | boolean |
110
+ And I have signed in with "joe@example.com/test"
111
+ And "joe@example.com" is an admin of the "Test" account
112
+ When I go to the settings page for the "Test" account
113
+ Then I should see "Your Plan"
114
+ And I should not see "Billing Information"
115
+ And I should see "Basic"
116
+ And I follow "Upgrade"
117
+ Then I should see "Upgrade Your Plan"
118
+ And the "Free" plan should be disabled
119
+ And I should see "Too big for Free."
120
+ And I should see "1 user" within ".basic"
121
+ And I should see "0 users" within ".free"
122
+ And I should see "1 project" within ".free"
123
+ And I should see "5 projects" within ".basic"
124
+ And I should see "ssl" within ".basic"
125
+ And I should not see "ssl" within ".free"
126
+
127
+ Scenario: Viewing current usage
128
+ Given a paid plan exists with a name of "Basic"
129
+ And the following account exists:
130
+ | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
131
+ | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
132
+ And the following limits exist:
133
+ | plan | name | value | value_type |
134
+ | name: Basic | users | 1 | number |
135
+ | name: Basic | projects | 5 | number |
136
+ | name: Basic | ssl | 1 | boolean |
137
+ And I have signed in with "joe@example.com/test"
138
+ And "joe@example.com" is an admin of the "Test" account
139
+ When I go to the settings page for the "Test" account
140
+ Then I should see "1/1" within ".users.meter"
141
+ And I should see "100.000%" within ".users.meter"
142
+ And I should see "0/5" within ".projects.meter"
143
+ And I should see "0.000%" within ".projects.meter"
@@ -0,0 +1,139 @@
1
+ Feature: Manage Projects
2
+ As a admin user
3
+ I want to be able to manage projects
4
+ In order to have a project for each of my software applications
5
+
6
+ Background:
7
+ Given the following accounts exist:
8
+ | name | keyword |
9
+ | Test | test |
10
+ | Another | another |
11
+ And the following user exists:
12
+ | name | email |
13
+ | Joe User | joe@example.com |
14
+ And "joe@example.com" is an admin of the "Test" account
15
+ And I sign in as "joe@example.com"
16
+
17
+ Scenario: Create new project with one account
18
+ When I go to the projects page for the "Test" account
19
+ And I follow "New Project"
20
+ Then the page should not include "select#project_account_id"
21
+ And the "Joe User" checkbox should be checked
22
+ When I fill in "Name" with "Project 1"
23
+ And I fill in "Keyword" with "project1"
24
+ And I should see "http://www.example.com/accounts/test/projects/keyword"
25
+ And I press "Create"
26
+ And I go to the projects page for the "Test" account
27
+ Then I should see "Project 1" within "ul.projects"
28
+
29
+ Scenario: Creating new project with two accounts shows the account selection
30
+ Given "joe@example.com" is an admin of the "Another" account
31
+ When I go to the projects page for the "Test" account
32
+ And I follow "New Project"
33
+ Then the page should include "select#project_account_id"
34
+
35
+ Scenario: Edit a project
36
+ Given the following project exists:
37
+ | account | name |
38
+ | name: Test | Project 1 |
39
+ When I go to the projects page for the "Test" account
40
+ And I follow "Project 1" within "ul.projects"
41
+ And I fill in "Name" with "Name Change"
42
+ And I press "Update"
43
+ Then I should see "Name Change"
44
+
45
+ @javascript
46
+ Scenario: Move a project
47
+ Given "joe@example.com" is an admin of the "Another" account
48
+ And the following projects exist:
49
+ | account | name |
50
+ | name: Test | Project 1 |
51
+ When I go to the projects page for the "Test" account
52
+ And I follow "Project 1" within "ul.projects"
53
+ And I select "Another" from "Account"
54
+ And I press "Update"
55
+ And I should see "Project 1" within "ul.projects"
56
+ Then I should be on the projects page for the "Another" account
57
+
58
+ @javascript
59
+ Scenario: Move a project when account being moved to is at the account limit
60
+ Given "joe@example.com" is an admin of the "Another" account
61
+ And the following limit exists for the "Another" account:
62
+ | name | value |
63
+ | projects | 1 |
64
+ And the following projects exist:
65
+ | account | name |
66
+ | name: Test | Project 1 |
67
+ | name: Another | Project 2 |
68
+ When I go to the projects page for the "Test" account
69
+ And I follow "Project 1" within "ul.projects"
70
+ And I select "Another" from "Account"
71
+ And I press "Update"
72
+ Then I should see "at your limit"
73
+ When I go to the projects page for the "Test" account
74
+ Then I should see "Project 1"
75
+
76
+ Scenario: Archive a project
77
+ Given the following project exists:
78
+ | account | name |
79
+ | name: Test | Project 1 |
80
+ When I go to the projects page for the "Test" account
81
+ And I follow "Project 1" within "ul.projects"
82
+ And I check "Archived"
83
+ And I press "Update"
84
+ And I should see "Project 1" within "ul.projects.archived"
85
+
86
+ Scenario: Unarchive a project
87
+ Given the following project exists:
88
+ | account | name | archived |
89
+ | name: Test | Project 1 | true |
90
+ When I go to the projects page for the "Test" account
91
+ And I follow "Project 1" within "ul.projects.archived"
92
+ And I uncheck "Archived"
93
+ And I press "Update"
94
+ And I should see "Project 1" within "ul.projects.active"
95
+
96
+ Scenario: Unarchive a project when at the account limit
97
+ Given the following limit exists for the "Test" account:
98
+ | name | value |
99
+ | projects | 1 |
100
+ And the following projects exist:
101
+ | account | name | archived |
102
+ | name: Test | Project 1 | false |
103
+ | name: Test | Project 2 | true |
104
+ When I go to the projects page for the "Test" account
105
+ And I follow "Project 2"
106
+ And I uncheck "Archived"
107
+ And I press "Update"
108
+ Then I should see "at your limit"
109
+ When I go to the projects page for the "Test" account
110
+ And I should see "Project 1" within "ul.projects.active"
111
+ And I should see "Project 2" within "ul.projects.archived"
112
+
113
+ Scenario: View all projects
114
+ Given the following projects exist:
115
+ | account | name | archived |
116
+ | name: Test | Project 1 | false |
117
+ | name: Test | Project 2 | false |
118
+ | name: Test | Project 3 | true |
119
+ | name: Other | Project 3 | false |
120
+ | name: Another | Project 4 | false |
121
+ And "joe@example.com" is a member of the "Other" account
122
+ When I go to the projects page for the "Test" account
123
+ Then I should see "Project 1" within "ul.projects.active"
124
+ And I should see "Project 2" within "ul.projects.active"
125
+ And I should see "Project 3" within "ul.projects.archived"
126
+ But I should not see "Project 3" within "ul.projects"
127
+ And I should not see "Project 4" within "ul.projects"
128
+
129
+ Scenario: Create new project when at the account limit
130
+ Given the following limit exists for the "Test" account:
131
+ | name | value |
132
+ | projects | 1 |
133
+ And the following project exists:
134
+ | account | name |
135
+ | name: Test | Project 1 |
136
+ When I go to the projects page for the "Test" account
137
+ And I follow "New Project"
138
+ Then I should be on the projects page for the "Test" account
139
+ And I should see "at your limit"
@@ -0,0 +1,142 @@
1
+ Feature: Managing users
2
+ As a admin user
3
+ In order to use the site with others
4
+ I want to be able to invite users, edit them and their permissions
5
+
6
+ Background:
7
+ Given an account exists with a name of "Test"
8
+ And I am signed in as an admin of the "Test" account
9
+ And I am on the memberships page for the "Test" account
10
+ And the following projects exist:
11
+ | account | name |
12
+ | name: Test | See me |
13
+ | name: Test | Can't find me |
14
+
15
+ Scenario: Invite new users
16
+ When I follow "Invite user"
17
+ And I fill in "Email" with "invitee@example.com"
18
+ And I check "See me"
19
+ And I press "Invite User"
20
+ Then I should see "invited"
21
+ When I sign out
22
+ And I follow the link sent to "invitee@example.com"
23
+ And I fill in the following new user:
24
+ | Name | Billy |
25
+ | Password | secret |
26
+ And I press "Accept Invitation"
27
+ Then I should be signed in
28
+ And "invitee@example.com" should be a member of the "See me" project
29
+ And "invitee@example.com" should be a member of the "Test" account
30
+ But "invitee@example.com" should not be a member of the "Can't find me" project
31
+ When I go to the settings page
32
+ Then the "Name" field should contain "Billy"
33
+
34
+ Scenario: Invite existing user who is not signed in
35
+ Given the following user exists:
36
+ | email | password |
37
+ | invitee@example.com | secret |
38
+ When I follow "Invite user"
39
+ And I fill in "Email" with "invitee@example.com"
40
+ And I press "Invite User"
41
+ Then I should see "invited"
42
+ When I sign out
43
+ And I follow the link sent to "invitee@example.com"
44
+ And I fill in the following existing user:
45
+ | Password | secret |
46
+ And I press "Accept Invitation"
47
+ Then I should be signed in
48
+ And "invitee@example.com" should be a member of the "Test" account
49
+
50
+ Scenario: Invite existing user who is signed in
51
+ Given the following user exists:
52
+ | email | password |
53
+ | invitee@example.com | secret |
54
+ When I follow "Invite user"
55
+ And I fill in "Email" with "invitee@example.com"
56
+ And I press "Invite User"
57
+ Then I should see "invited"
58
+ When I sign out
59
+ When I sign in as "invitee@example.com/secret"
60
+ And I follow the link sent to "invitee@example.com"
61
+ Then I should be signed in
62
+ And "invitee@example.com" should be a member of the "Test" account
63
+
64
+ Scenario: Fail to accept an invitation
65
+ Given the following invitation exists:
66
+ | email |
67
+ | invitee@example.com |
68
+ When I follow the link sent to "invitee@example.com"
69
+ And I press "Accept Invitation"
70
+ Then the form should have inline error messages
71
+
72
+ Scenario: Invite admin users
73
+ Given the following user exists:
74
+ | email | password |
75
+ | invitee@example.com | secret |
76
+ When I follow "Invite user"
77
+ And I fill in "Email" with "invitee@example.com"
78
+ And I check "Grant administrator privileges"
79
+ And I press "Invite User"
80
+ And I sign out
81
+ And I follow the link sent to "invitee@example.com"
82
+ And I fill in the following existing user:
83
+ | Password | secret |
84
+ And I press "Accept Invitation"
85
+ Then I should be signed in
86
+ And "invitee@example.com" should be an admin member of the "Test" account
87
+
88
+ Scenario: invalid invitation
89
+ When I follow "Invite user"
90
+ And I press "Invite User"
91
+ Then the form should have inline error messages
92
+
93
+ Scenario: view account members
94
+ Given the following users exist:
95
+ | name |
96
+ | Bill |
97
+ | John |
98
+ | Frank |
99
+ And the following memberships exist:
100
+ | account | user |
101
+ | name: Test | name: Bill |
102
+ | name: Test | name: Frank |
103
+ When I go to the memberships page for the "Test" account
104
+ Then I should see "Bill"
105
+ And I should see "Frank"
106
+ And I should not see "John"
107
+
108
+ Scenario: remove a user from an account
109
+ Given an user exists with a name of "Frank"
110
+ And the following memberships exist:
111
+ | account | user |
112
+ | name: Test | name: Frank |
113
+ When I go to the memberships page for the "Test" account
114
+ And I follow "Frank"
115
+ Then I should see "Frank belongs to these projects:"
116
+ And I should see "Frank is an Admin on Test"
117
+ When I follow "Remove Frank from Test"
118
+ Then I should see "User removed"
119
+ And I should be on the memberships page for the "Test" account
120
+ And I should not see "Frank"
121
+
122
+ Scenario: remove yourself from an account
123
+ Given an user exists with a name of "Frank"
124
+ And the following memberships exist:
125
+ | account | user |
126
+ | name: Test | name: Frank |
127
+ When I go to the settings page
128
+ And I fill in "Name" with "My Name"
129
+ And I press "Update"
130
+ When I go to the memberships page for the "Test" account
131
+ And I follow "My Name"
132
+ When I follow "Remove My Name from Test"
133
+ Then I should see "User removed"
134
+ Then I should be on the settings page
135
+
136
+ Scenario: Invite new user when at the account limit
137
+ Given the following limit exists for the "Test" account:
138
+ | name | value |
139
+ | users | 1 |
140
+ When I follow "Invite user"
141
+ Then I should be on the memberships page for the "Test" account
142
+ And I should see "at your limit"