saucy 0.14.3 → 0.14.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +60 -58
  4. data/app/controllers/accounts_controller.rb +0 -1
  5. data/app/controllers/admin/trial_extensions_controller.rb +13 -0
  6. data/app/views/admin/accounts/show.html.erb +13 -0
  7. data/config/routes.rb +1 -0
  8. data/features/run_features.feature +3 -2
  9. data/lib/generators/saucy/features/templates/features/manage_billing.feature +12 -7
  10. data/lib/generators/saucy/features/templates/features/manage_plan.feature +12 -6
  11. data/lib/generators/saucy/features/templates/features/new_account.feature +4 -9
  12. data/lib/generators/saucy/features/templates/features/sign_up.feature +1 -1
  13. data/lib/generators/saucy/features/templates/features/sign_up_coupon.feature +1 -2
  14. data/lib/generators/saucy/features/templates/features/sign_up_paid.feature +1 -1
  15. data/lib/generators/saucy/features/templates/features/trial_plans.feature +1 -1
  16. data/lib/saucy/account.rb +8 -0
  17. data/lib/saucy/projects_controller.rb +2 -5
  18. data/lib/saucy/subscription.rb +5 -1
  19. data/lib/saucy/version.rb +1 -1
  20. data/saucy.gemspec +2 -2
  21. data/spec/controllers/accounts_controller_spec.rb +9 -9
  22. data/spec/controllers/admin/trial_extensions_controller_spec.rb +67 -0
  23. data/spec/controllers/invitations_controller_spec.rb +13 -7
  24. data/spec/controllers/memberships_controller_spec.rb +10 -7
  25. data/spec/controllers/profiles_controller_spec.rb +8 -2
  26. data/spec/controllers/projects_controller_spec.rb +20 -16
  27. data/spec/environment.rb +3 -3
  28. data/spec/models/account_spec.rb +29 -0
  29. data/spec/models/subscription_spec.rb +33 -11
  30. data/spec/support/clearance.rb +1 -0
  31. data/spec/views/accounts/show.html.erb_spec.rb +41 -0
  32. metadata +59 -14
  33. data/spec/support/clearance_matchers.rb +0 -55
@@ -1,3 +1,8 @@
1
+ 0.14.5
2
+
3
+ * Upgrade to clearance 0.14.0. (Motivated by getting rid of some redundant flashes)
4
+ * Remove Account and Project creation flashes
5
+
1
6
  0.14.3
2
7
 
3
8
  * Redirect to upgrade page if beyond limit
data/Gemfile CHANGED
@@ -6,8 +6,9 @@ gemspec
6
6
  gem "cucumber-rails", '~> 1.0.6', :require => false
7
7
  gem "capybara", :require => false
8
8
  gem "factory_girl_rails", :require => false
9
- gem "formtastic", :require => false
9
+ gem "formtastic", '~> 1.2.4', :require => false
10
10
  gem "database_cleaner", :require => false
11
11
  gem "dynamic_form", :require => false
12
12
  gem "launchy", :require => false
13
13
  gem "jquery-rails", :require => false
14
+ gem "selenium-webdriver", "~> 2.16.0"
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- saucy (0.14.2)
4
+ saucy (0.14.4)
5
5
  airbrake (~> 3.0.4)
6
6
  braintree (>= 2.6.2)
7
- clearance (~> 0.11.2)
8
- formtastic (>= 1.2)
7
+ clearance (~> 0.14.0)
8
+ formtastic (~> 1.2.4)
9
9
  railties (>= 3.0.3)
10
10
  sham_rack (= 1.3.3)
11
11
  sinatra (>= 1.1.2)
@@ -13,37 +13,36 @@ PATH
13
13
  GEM
14
14
  remote: http://rubygems.org/
15
15
  specs:
16
- actionmailer (3.1.0)
17
- actionpack (= 3.1.0)
16
+ actionmailer (3.1.3)
17
+ actionpack (= 3.1.3)
18
18
  mail (~> 2.3.0)
19
- actionpack (3.1.0)
20
- activemodel (= 3.1.0)
21
- activesupport (= 3.1.0)
19
+ actionpack (3.1.3)
20
+ activemodel (= 3.1.3)
21
+ activesupport (= 3.1.3)
22
22
  builder (~> 3.0.0)
23
23
  erubis (~> 2.7.0)
24
24
  i18n (~> 0.6)
25
- rack (~> 1.3.2)
26
- rack-cache (~> 1.0.3)
25
+ rack (~> 1.3.5)
26
+ rack-cache (~> 1.1)
27
27
  rack-mount (~> 0.8.2)
28
28
  rack-test (~> 0.6.1)
29
- sprockets (~> 2.0.0)
30
- activemodel (3.1.0)
31
- activesupport (= 3.1.0)
32
- bcrypt-ruby (~> 3.0.0)
29
+ sprockets (~> 2.0.3)
30
+ activemodel (3.1.3)
31
+ activesupport (= 3.1.3)
33
32
  builder (~> 3.0.0)
34
33
  i18n (~> 0.6)
35
- activerecord (3.1.0)
36
- activemodel (= 3.1.0)
37
- activesupport (= 3.1.0)
34
+ activerecord (3.1.3)
35
+ activemodel (= 3.1.3)
36
+ activesupport (= 3.1.3)
38
37
  arel (~> 2.2.1)
39
38
  tzinfo (~> 0.3.29)
40
- activeresource (3.1.0)
41
- activemodel (= 3.1.0)
42
- activesupport (= 3.1.0)
43
- activesupport (3.1.0)
39
+ activeresource (3.1.3)
40
+ activemodel (= 3.1.3)
41
+ activesupport (= 3.1.3)
42
+ activesupport (3.1.3)
44
43
  multi_json (~> 1.0)
45
44
  addressable (2.2.6)
46
- airbrake (3.0.4)
45
+ airbrake (3.0.9)
47
46
  activesupport
48
47
  builder
49
48
  arel (2.2.1)
@@ -55,10 +54,9 @@ GEM
55
54
  rspec (>= 2.6.0)
56
55
  bcat (0.6.2)
57
56
  rack (~> 1.0)
58
- bcrypt-ruby (3.0.0)
59
57
  bourne (1.0)
60
58
  mocha (= 0.9.8)
61
- braintree (2.11.0)
59
+ braintree (2.13.2)
62
60
  builder (>= 2.0.0)
63
61
  builder (3.0.0)
64
62
  capybara (1.1.1)
@@ -68,10 +66,10 @@ GEM
68
66
  rack-test (>= 0.5.4)
69
67
  selenium-webdriver (~> 2.0)
70
68
  xpath (~> 0.1.4)
71
- childprocess (0.2.2)
69
+ childprocess (0.2.9)
72
70
  ffi (~> 1.0.6)
73
- clearance (0.11.2)
74
- diesel (~> 0.1.4)
71
+ clearance (0.14.0)
72
+ diesel (~> 0.1.5)
75
73
  rails (>= 3.0)
76
74
  cucumber (1.0.6)
77
75
  builder (>= 2.1.2)
@@ -95,7 +93,7 @@ GEM
95
93
  factory_girl_rails (1.2.0)
96
94
  factory_girl (~> 2.1.0)
97
95
  railties (>= 3.0.0)
98
- ffi (1.0.10)
96
+ ffi (1.0.11)
99
97
  formtastic (1.2.4)
100
98
  actionpack (>= 2.3.7)
101
99
  activesupport (>= 2.3.7)
@@ -107,8 +105,7 @@ GEM
107
105
  jquery-rails (1.0.14)
108
106
  railties (~> 3.0)
109
107
  thor (~> 0.14)
110
- json (1.6.1)
111
- json_pure (1.6.1)
108
+ json (1.6.4)
112
109
  launchy (2.0.5)
113
110
  addressable (~> 2.2.6)
114
111
  mail (2.3.0)
@@ -118,36 +115,39 @@ GEM
118
115
  mime-types (1.17.2)
119
116
  mocha (0.9.8)
120
117
  rake
121
- multi_json (1.0.3)
118
+ multi_json (1.0.4)
122
119
  nokogiri (1.5.0)
123
- polyglot (0.3.2)
124
- rack (1.3.5)
125
- rack-cache (1.0.3)
120
+ polyglot (0.3.3)
121
+ rack (1.3.6)
122
+ rack-cache (1.1)
126
123
  rack (>= 0.4)
127
124
  rack-mount (0.8.3)
128
125
  rack (>= 1.0.0)
126
+ rack-protection (1.2.0)
127
+ rack
129
128
  rack-ssl (1.3.2)
130
129
  rack
131
130
  rack-test (0.6.1)
132
131
  rack (>= 1.0)
133
- rails (3.1.0)
134
- actionmailer (= 3.1.0)
135
- actionpack (= 3.1.0)
136
- activerecord (= 3.1.0)
137
- activeresource (= 3.1.0)
138
- activesupport (= 3.1.0)
132
+ rails (3.1.3)
133
+ actionmailer (= 3.1.3)
134
+ actionpack (= 3.1.3)
135
+ activerecord (= 3.1.3)
136
+ activeresource (= 3.1.3)
137
+ activesupport (= 3.1.3)
139
138
  bundler (~> 1.0)
140
- railties (= 3.1.0)
141
- railties (3.1.0)
142
- actionpack (= 3.1.0)
143
- activesupport (= 3.1.0)
139
+ railties (= 3.1.3)
140
+ railties (3.1.3)
141
+ actionpack (= 3.1.3)
142
+ activesupport (= 3.1.3)
144
143
  rack-ssl (~> 1.3.2)
145
144
  rake (>= 0.8.7)
146
145
  rdoc (~> 3.4)
147
146
  thor (~> 0.14.6)
148
- rake (0.9.2)
147
+ rake (0.9.2.2)
149
148
  rdiscount (1.6.8)
150
- rdoc (3.9.4)
149
+ rdoc (3.12)
150
+ json (~> 1.4)
151
151
  rspec (2.6.0)
152
152
  rspec-core (~> 2.6.0)
153
153
  rspec-expectations (~> 2.6.0)
@@ -161,22 +161,23 @@ GEM
161
161
  activesupport (~> 3.0)
162
162
  railties (~> 3.0)
163
163
  rspec (~> 2.6.0)
164
- rubyzip (0.9.4)
165
- selenium-webdriver (2.8.0)
166
- childprocess (>= 0.2.1)
167
- ffi (>= 1.0.7)
168
- json_pure
164
+ rubyzip (0.9.5)
165
+ selenium-webdriver (2.16.0)
166
+ childprocess (>= 0.2.5)
167
+ ffi (~> 1.0.9)
168
+ multi_json (~> 1.0.4)
169
169
  rubyzip
170
170
  sham_rack (1.3.3)
171
171
  rack
172
172
  shoulda-matchers (1.0.0)
173
- sinatra (1.2.6)
174
- rack (~> 1.1)
175
- tilt (>= 1.2.2, < 2.0)
176
- sprockets (2.0.0)
173
+ sinatra (1.3.2)
174
+ rack (>= 1.3.6, ~> 1.3)
175
+ rack-protection (~> 1.2)
176
+ tilt (>= 1.3.3, ~> 1.3)
177
+ sprockets (2.0.3)
177
178
  hike (~> 1.2)
178
179
  rack (~> 1.0)
179
- tilt (~> 1.1, != 1.3.0)
180
+ tilt (!= 1.3.0, ~> 1.1)
180
181
  sqlite3 (1.3.4)
181
182
  term-ansicolor (1.0.7)
182
183
  thin (1.2.11)
@@ -189,7 +190,7 @@ GEM
189
190
  treetop (1.4.10)
190
191
  polyglot
191
192
  polyglot (>= 0.3.1)
192
- tzinfo (0.3.29)
193
+ tzinfo (0.3.31)
193
194
  xpath (0.1.4)
194
195
  nokogiri (~> 1.3)
195
196
 
@@ -206,13 +207,14 @@ DEPENDENCIES
206
207
  dynamic_form
207
208
  factory_girl
208
209
  factory_girl_rails
209
- formtastic
210
+ formtastic (~> 1.2.4)
210
211
  jquery-rails
211
212
  launchy
212
213
  rails (>= 3.0.3)
213
214
  rake
214
215
  rspec-rails
215
216
  saucy!
217
+ selenium-webdriver (~> 2.16.0)
216
218
  shoulda-matchers (~> 1.0.0)
217
219
  sqlite3
218
220
  thin
@@ -24,7 +24,6 @@ class AccountsController < ApplicationController
24
24
  if @signup.save
25
25
  Saucy::Notifications.notify_observers("account_created", :request => request,
26
26
  :account => @signup.account)
27
- flash[:success] = "Account was created."
28
27
  sign_in @signup.user
29
28
  redirect_to new_account_project_path(@signup.account)
30
29
  else
@@ -0,0 +1,13 @@
1
+ class Admin::TrialExtensionsController < Admin::BaseController
2
+ def create
3
+ @account = Account.find_by_keyword(params[:account_id])
4
+ @account.reset_trial_expiration
5
+ if @account.save
6
+ redirect_to admin_account_path(@account)
7
+ else
8
+ flash[:error] = t("trial_extensions.show.invalid",
9
+ :default => "The account's trial cannot be extended.")
10
+ render "admin/accounts/show"
11
+ end
12
+ end
13
+ end
@@ -13,6 +13,19 @@
13
13
  <%= render :partial => 'admin/accounts/account', :object => @account %>
14
14
  </table>
15
15
 
16
+ <%if @account.trial? -%>
17
+ <h3>This is a trial account</h3>
18
+ <p>
19
+ <% if @account.expired? -%>
20
+ It <em>expired</em> on <%= @account.trial_expires_at.to_s(:short_date)%>
21
+ <%= button_to "Extend the trial to #{Saucy::Configuration.trial_length} days from now", admin_account_trial_extensions_path(@account) %>
22
+ <% else -%>
23
+ It's set to expire on <%= @account.trial_expires_at.to_s(:short_date) %>
24
+ <%= button_to "Extend the trial by #{Saucy::Configuration.trial_length} days", admin_account_trial_extensions_path(@account) %>
25
+ <% end -%>
26
+ </p>
27
+ <% end -%>
28
+
16
29
  <h3>Projects</h3>
17
30
  <% unless @account.projects.empty? -%>
18
31
  <table>
@@ -20,6 +20,7 @@ Rails.application.routes.draw do
20
20
  namespace :admin do
21
21
  resources :accounts, :only => [:index, :show] do
22
22
  get :search, :on => :collection
23
+ resource :trial_extensions, :only => [:create]
23
24
  end
24
25
  resources :users, :only => [:index, :show] do
25
26
  get :search, :on => :collection
@@ -7,13 +7,14 @@ Feature: generate a saucy application and run rake
7
7
  And I copy the locked Gemfile from this project
8
8
  And I append to "Gemfile" with:
9
9
  """
10
- gem "clearance", "~> 0.11.2"
10
+ gem "clearance", "~> 0.14.0"
11
11
  gem "cucumber-rails"
12
+ gem "selenium-webdriver", "~> 2.16.0"
12
13
  gem "capybara"
13
14
  gem "factory_girl_rails"
14
15
  gem "dynamic_form"
15
16
  gem "database_cleaner"
16
- gem "formtastic"
17
+ gem "formtastic", "~> 1.2.4"
17
18
  gem "rspec-rails"
18
19
  gem "bourne"
19
20
  gem "shoulda-matchers"
@@ -10,7 +10,8 @@ Feature: Manage Billing
10
10
  | Test | test | name: Paid | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 | 1 Robo Lane | Suite 333 | Beverly Hills | CA | 90210 | United States of America |
11
11
 
12
12
  Scenario: Update the billing information on an account with a paid plan
13
- Given I have signed in with "joe@example.com"
13
+ Given I have signed up as "joe@example.com"
14
+ And I sign in with "joe@example.com"
14
15
  And "joe@example.com" is an admin of the "Test" account
15
16
  When I go to the billing page for the "Test" account
16
17
  Then I should see "card ending in 5555"
@@ -55,8 +56,9 @@ Feature: Manage Billing
55
56
  And the "Country" field should contain "Uganda"
56
57
 
57
58
  Scenario: Be forced to update the billing information on an account with a paid plan that is past due
58
- Given the "Test" account is past due
59
- And I have signed in with "joe@example.com"
59
+ Given I have signed up as "joe@example.com"
60
+ And the "Test" account is past due
61
+ And I sign in with "joe@example.com"
60
62
  And "joe@example.com" is an admin of the "Test" account
61
63
  When I go to the settings page for the "Test" account
62
64
  Then I should be on the billing page for the "Test" account
@@ -78,11 +80,12 @@ Feature: Manage Billing
78
80
  Then I should be on the billing page for the "Test" account
79
81
 
80
82
  Scenario: View past credit card charges
81
- Given the following transaction exist for the "Test" account:
83
+ Given I have signed up as "joe@example.com"
84
+ And the following transaction exist for the "Test" account:
82
85
  | status | amount | created_at |
83
86
  | Settled | 20.00 | July 1, 2010 |
84
87
  | Settled | 5.00 | August 1, 2010 |
85
- And I have signed in with "joe@example.com"
88
+ And I sign in with "joe@example.com"
86
89
  And "joe@example.com" is an admin of the "Test" account
87
90
  When I go to the billing page for the "Test" account
88
91
  Then I should see "Your Invoices"
@@ -90,7 +93,8 @@ Feature: Manage Billing
90
93
  And I should see "08/01/10 $5"
91
94
 
92
95
  Scenario: Navigate back to the main settings page
93
- Given I have signed in with "joe@example.com"
96
+ Given I have signed up as "joe@example.com"
97
+ And I sign in with "joe@example.com"
94
98
  And "joe@example.com" is an admin of the "Test" account
95
99
  When I go to the billing page for the "Test" account
96
100
  And I follow "Change"
@@ -99,7 +103,8 @@ Feature: Manage Billing
99
103
  Then I should be on the settings page for the "Test" account
100
104
 
101
105
  Scenario: Billing countries
102
- Given I have signed in with "joe@example.com"
106
+ Given I have signed up as "joe@example.com"
107
+ And I sign in with "joe@example.com"
103
108
  And "joe@example.com" is an admin of the "Test" account
104
109
  When I go to the billing page for the "Test" account
105
110
  And I follow "Change"
@@ -9,7 +9,8 @@ Feature: Manage Plan
9
9
  And the following paid account exists:
10
10
  | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
11
11
  | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
12
- And I have signed in with "joe@example.com"
12
+ And I have signed up as "joe@example.com"
13
+ And I sign in with "joe@example.com"
13
14
  And "joe@example.com" is an admin of the "Test" account
14
15
  When I go to the settings page for the "Test" account
15
16
  Then I should see "Your Plan"
@@ -28,7 +29,8 @@ Feature: Manage Plan
28
29
  And the following account exists:
29
30
  | name | keyword | plan |
30
31
  | Test | test | name: Free |
31
- And I have signed in with "joe@example.com"
32
+ And I have signed up as "joe@example.com"
33
+ And I sign in with "joe@example.com"
32
34
  And "joe@example.com" is an admin of the "Test" account
33
35
  When I go to the settings page for the "Test" account
34
36
  Then I should not see "Billing" within ".subnav"
@@ -62,7 +64,8 @@ Feature: Manage Plan
62
64
  And the following account exists:
63
65
  | name | keyword | plan |
64
66
  | Test | test | name: Free |
65
- And I have signed in with "joe@example.com"
67
+ And I have signed up as "joe@example.com"
68
+ And I sign in with "joe@example.com"
66
69
  And "joe@example.com" is an admin of the "Test" account
67
70
  When I go to the settings page for the "Test" account
68
71
  Then I should not see "Billing" within ".subnav"
@@ -92,7 +95,8 @@ Feature: Manage Plan
92
95
  And the following paid account exists:
93
96
  | name | keyword | plan | cardholder_name | billing_email | card_number | verification_code | expiration_month | expiration_year |
94
97
  | Test | test | name: Basic | Joe Smith | jsmith@example.com | 4111111111115555 | 122 | 01 | 2015 |
95
- And I have signed in with "joe@example.com"
98
+ And I have signed up as "joe@example.com"
99
+ And I sign in with "joe@example.com"
96
100
  And "joe@example.com" is an admin of the "Test" account
97
101
  When I go to the settings page for the "Test" account
98
102
  Then I should see "Your Plan"
@@ -119,7 +123,8 @@ Feature: Manage Plan
119
123
  | name: Free | projects | 1 | number |
120
124
  | name: Basic | ssl | 1 | boolean |
121
125
  | name: Free | ssl | 0 | boolean |
122
- And I have signed in with "joe@example.com"
126
+ And I have signed up as "joe@example.com"
127
+ And I sign in with "joe@example.com"
123
128
  And "joe@example.com" is an admin of the "Test" account
124
129
  When I go to the settings page for the "Test" account
125
130
  Then I should see "Your Plan"
@@ -146,7 +151,8 @@ Feature: Manage Plan
146
151
  | name: Basic | users | 1 | number |
147
152
  | name: Basic | projects | 5 | number |
148
153
  | name: Basic | ssl | 1 | boolean |
149
- And I have signed in with "joe@example.com"
154
+ And I have signed up as "joe@example.com"
155
+ And I sign in with "joe@example.com"
150
156
  And "joe@example.com" is an admin of the "Test" account
151
157
  When I go to the settings page for the "Test" account
152
158
  Then I should see "1/1" within ".users.meter"
@@ -9,25 +9,20 @@ Feature: user adds a new account
9
9
  And I fill in "Email" with "user@example.com"
10
10
  And I fill in "Password" with "test"
11
11
  And I press "Sign up"
12
- Then I should see "created"
13
- But I should not see "Instructions for confirming"
14
- And I should be on the new project page for the newest account by "user@example.com"
12
+ Then I should be on the new project page for the newest account by "user@example.com"
15
13
 
16
14
  Scenario: sign up for two accounts
17
15
  When I go to the sign up page for the "Free" plan
18
16
  And I fill in "Email" with "email@person.com"
19
17
  And I fill in "Password" with "password"
20
18
  And I press "Sign up"
21
- Then I should see "created"
22
- And I should be on the new project page for the newest account by "email@person.com"
19
+ Then I should be on the new project page for the newest account by "email@person.com"
23
20
  When I go to the settings page
24
21
  Then I should see 1 account
25
22
  And I follow "Add new account"
26
23
  And I follow "Free"
27
24
  Then I should see "Your existing user, email, will be added as the first administrator on this new account."
28
- And I press "Sign up"
29
- Then I should see "created"
30
- But I should not see "Instructions for confirming"
31
- And I should be on the new project page for the newest account by "email@person.com"
25
+ When I press "Sign up"
26
+ Then I should be on the new project page for the newest account by "email@person.com"
32
27
  When I go to the settings page
33
28
  Then I should see 2 accounts