clearance 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of clearance might be problematic. Click here for more details.
- data/CHANGELOG.md +6 -0
- data/README.md +15 -4
- data/VERSION +1 -1
- data/app/controllers/clearance/passwords_controller.rb +14 -6
- data/lib/clearance.rb +0 -3
- data/lib/clearance/shoulda_macros.rb +1 -176
- data/lib/rails/generators/clearance_features_templates/features/password_reset.feature +4 -3
- data/lib/rails/generators/clearance_features_templates/features/sign_in.feature +3 -2
- data/lib/rails/generators/clearance_features_templates/features/sign_out.feature +4 -3
- data/lib/rails/generators/clearance_features_templates/features/sign_up.feature +3 -2
- data/lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb +2 -10
- data/spec/rails_root/Gemfile.lock +143 -0
- data/spec/rails_root/app/views/passwords/edit.html.erb +21 -0
- data/spec/rails_root/app/views/passwords/new.html.erb +15 -0
- data/spec/rails_root/app/views/sessions/new.html.erb +21 -0
- data/spec/rails_root/app/views/users/_inputs.html.erb +6 -0
- data/spec/rails_root/app/views/users/new.html.erb +10 -0
- data/spec/rails_root/db/development.sqlite3 +0 -0
- data/spec/rails_root/db/migrate/20110209234521_clearance_create_users.rb +19 -0
- data/spec/rails_root/db/schema.rb +28 -0
- data/spec/rails_root/db/test.sqlite3 +0 -0
- data/spec/rails_root/features/password_reset.feature +40 -0
- data/spec/rails_root/features/sign_in.feature +28 -0
- data/spec/rails_root/features/sign_out.feature +16 -0
- data/spec/rails_root/features/sign_up.feature +21 -0
- data/spec/rails_root/features/step_definitions/clearance_steps.rb +109 -0
- data/spec/rails_root/log/development.log +536 -0
- data/spec/rails_root/log/test.log +7600 -0
- data/spec/rails_root/test/factories/clearance.rb +13 -0
- data/spec/rails_root/test/functional/accounts_controller_test.rb +22 -0
- data/spec/rails_root/test/performance/browsing_test.rb +9 -0
- data/spec/rails_root/test/test_helper.rb +13 -0
- data/spec/rails_root/vendor/Gemfile +17 -0
- data/spec/rails_root/vendor/Gemfile.lock +143 -0
- data/spec/rails_root/vendor/README +244 -0
- data/spec/rails_root/vendor/Rakefile +10 -0
- data/spec/rails_root/vendor/app/controllers/accounts_controller.rb +10 -0
- data/spec/rails_root/vendor/app/controllers/application_controller.rb +6 -0
- data/spec/rails_root/vendor/app/helpers/application_helper.rb +2 -0
- data/spec/rails_root/vendor/app/models/user.rb +3 -0
- data/spec/rails_root/vendor/app/views/accounts/edit.html.erb +0 -0
- data/spec/rails_root/vendor/app/views/layouts/application.html.erb +24 -0
- data/spec/rails_root/vendor/app/views/passwords/edit.html.erb +21 -0
- data/spec/rails_root/vendor/app/views/passwords/new.html.erb +15 -0
- data/spec/rails_root/vendor/app/views/sessions/new.html.erb +21 -0
- data/spec/rails_root/vendor/app/views/users/_inputs.html.erb +6 -0
- data/spec/rails_root/vendor/app/views/users/new.html.erb +10 -0
- data/spec/rails_root/vendor/config.ru +4 -0
- data/spec/rails_root/vendor/config/application.rb +46 -0
- data/spec/rails_root/vendor/config/boot.rb +6 -0
- data/spec/rails_root/vendor/config/cucumber.yml +8 -0
- data/spec/rails_root/vendor/config/database.yml +25 -0
- data/spec/rails_root/vendor/config/environment.rb +7 -0
- data/spec/rails_root/vendor/config/environments/development.rb +21 -0
- data/spec/rails_root/vendor/config/environments/production.rb +42 -0
- data/spec/rails_root/vendor/config/environments/test.rb +34 -0
- data/spec/rails_root/vendor/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_root/vendor/config/initializers/clearance.rb +3 -0
- data/spec/rails_root/vendor/config/initializers/inflections.rb +10 -0
- data/spec/rails_root/vendor/config/initializers/mime_types.rb +5 -0
- data/spec/rails_root/vendor/config/initializers/secret_token.rb +7 -0
- data/spec/rails_root/vendor/config/initializers/session_store.rb +8 -0
- data/spec/rails_root/vendor/config/locales/en.yml +5 -0
- data/spec/rails_root/vendor/config/routes.rb +61 -0
- data/spec/rails_root/vendor/db/development.sqlite3 +0 -0
- data/spec/rails_root/vendor/db/migrate/20101220184900_clearance_create_users.rb +20 -0
- data/spec/rails_root/vendor/db/schema.rb +29 -0
- data/spec/rails_root/vendor/db/test.sqlite3 +0 -0
- data/spec/rails_root/vendor/doc/README_FOR_APP +2 -0
- data/spec/rails_root/vendor/features/password_reset.feature +33 -0
- data/spec/rails_root/vendor/features/sign_in.feature +35 -0
- data/spec/rails_root/vendor/features/sign_out.feature +15 -0
- data/spec/rails_root/vendor/features/sign_up.feature +45 -0
- data/spec/rails_root/vendor/features/step_definitions/clearance_steps.rb +138 -0
- data/spec/rails_root/vendor/features/step_definitions/web_steps.rb +219 -0
- data/spec/rails_root/vendor/features/support/env.rb +57 -0
- data/spec/rails_root/vendor/features/support/paths.rb +45 -0
- data/spec/rails_root/vendor/lib/tasks/cucumber.rake +53 -0
- data/spec/rails_root/vendor/log/development.log +663 -0
- data/spec/rails_root/vendor/log/test.log +22745 -0
- data/spec/rails_root/vendor/public/404.html +26 -0
- data/spec/rails_root/vendor/public/422.html +26 -0
- data/spec/rails_root/vendor/public/500.html +26 -0
- data/spec/rails_root/vendor/public/favicon.ico +0 -0
- data/spec/rails_root/vendor/public/images/rails.png +0 -0
- data/spec/rails_root/vendor/public/javascripts/application.js +2 -0
- data/spec/rails_root/vendor/public/javascripts/controls.js +965 -0
- data/spec/rails_root/vendor/public/javascripts/dragdrop.js +974 -0
- data/spec/rails_root/vendor/public/javascripts/effects.js +1123 -0
- data/spec/rails_root/vendor/public/javascripts/prototype.js +4874 -0
- data/spec/rails_root/vendor/public/javascripts/rails.js +118 -0
- data/spec/rails_root/vendor/public/robots.txt +5 -0
- data/spec/rails_root/vendor/script/cucumber +10 -0
- data/spec/rails_root/vendor/script/rails +9 -0
- data/spec/rails_root/vendor/test/factories/clearance.rb +13 -0
- data/spec/rails_root/vendor/test/functional/accounts_controller_test.rb +22 -0
- data/spec/rails_root/vendor/test/performance/browsing_test.rb +9 -0
- data/spec/rails_root/vendor/test/test_helper.rb +13 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/MIT-LICENSE +20 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/README +13 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/Rakefile +10 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/init.rb +5 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +8 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
- data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
- data/test/controllers/passwords_controller_test.rb +19 -0
- data/test/models/clearance_mailer_test.rb +1 -1
- data/test/rails_root/Gemfile.lock +145 -0
- data/test/rails_root/app/views/passwords/edit.html.erb +21 -0
- data/test/rails_root/app/views/passwords/new.html.erb +15 -0
- data/test/rails_root/app/views/sessions/new.html.erb +21 -0
- data/test/rails_root/app/views/users/_inputs.html.erb +6 -0
- data/test/rails_root/app/views/users/new.html.erb +10 -0
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/migrate/20110209234101_clearance_create_users.rb +19 -0
- data/test/rails_root/db/schema.rb +28 -0
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/features/password_reset.feature +40 -0
- data/test/rails_root/features/sign_in.feature +28 -0
- data/test/rails_root/features/sign_out.feature +16 -0
- data/test/rails_root/features/sign_up.feature +21 -0
- data/test/rails_root/features/step_definitions/clearance_steps.rb +109 -0
- data/test/rails_root/log/development.log +938 -0
- data/test/rails_root/log/test.log +20303 -0
- data/test/test_helper.rb +1 -0
- metadata +263 -42
- data/clearance.gemspec +0 -198
- data/cucumber.yml +0 -4
- data/init.rb +0 -1
- data/lib/clearance/extensions/errors.rb +0 -6
- data/lib/clearance/extensions/rescue.rb +0 -5
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,10 @@ Rails authentication with email & password.
|
|
5
5
|
|
6
6
|
[We have clearance, Clarence.](http://www.youtube.com/watch?v=fVq4_HhBK8Y)
|
7
7
|
|
8
|
+
Clearance was extracted out of [Hoptoad](http://hoptoadapp.com). We merged the
|
9
|
+
authentication code from two of thoughtbot's client Rails apps and have since
|
10
|
+
used it each time we needed authentication.
|
11
|
+
|
8
12
|
Help
|
9
13
|
----
|
10
14
|
|
@@ -118,11 +122,18 @@ Check out some of the ways people have extended Clearance:
|
|
118
122
|
* [Clearance Twitter](https://github.com/thoughtbot/clearance-twitter)
|
119
123
|
* [Clearance Admin](https://github.com/xenda/clearance-admin)
|
120
124
|
|
121
|
-
|
125
|
+
Credits
|
122
126
|
-------
|
123
127
|
|
124
|
-
|
125
|
-
|
126
|
-
|
128
|
+
![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
|
129
|
+
|
130
|
+
Clearance is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
|
127
131
|
|
128
132
|
Thank you to all [the contributors](https://github.com/thoughtbot/clearance/contributors)!
|
133
|
+
|
134
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
135
|
+
|
136
|
+
License
|
137
|
+
-------
|
138
|
+
|
139
|
+
Clearance is Copyright © 2009-2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
@@ -45,17 +45,25 @@ class Clearance::PasswordsController < ApplicationController
|
|
45
45
|
|
46
46
|
def forbid_missing_token
|
47
47
|
if params[:token].blank?
|
48
|
-
|
48
|
+
flash_failure_when_forbidden
|
49
|
+
render :template => 'passwords/new'
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
53
|
def forbid_non_existent_user
|
53
54
|
unless ::User.find_by_id_and_confirmation_token(
|
54
55
|
params[:user_id], params[:token])
|
55
|
-
|
56
|
+
flash_failure_when_forbidden
|
57
|
+
render :template => 'passwords/new'
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
61
|
+
def flash_failure_when_forbidden
|
62
|
+
flash.now[:failure] = translate(:forbidden,
|
63
|
+
:scope => [:clearance, :controllers, :passwords],
|
64
|
+
:default => "Please double check the URL or try submitting the form again.")
|
65
|
+
end
|
66
|
+
|
59
67
|
def flash_notice_after_create
|
60
68
|
flash[:notice] = translate(:deliver_change_password,
|
61
69
|
:scope => [:clearance, :controllers, :passwords],
|
@@ -69,14 +77,14 @@ class Clearance::PasswordsController < ApplicationController
|
|
69
77
|
:default => "Unknown email.")
|
70
78
|
end
|
71
79
|
|
72
|
-
def url_after_create
|
73
|
-
sign_in_url
|
74
|
-
end
|
75
|
-
|
76
80
|
def flash_success_after_update
|
77
81
|
flash[:success] = translate(:signed_in, :default => "Signed in.")
|
78
82
|
end
|
79
83
|
|
84
|
+
def url_after_create
|
85
|
+
sign_in_url
|
86
|
+
end
|
87
|
+
|
80
88
|
def url_after_update
|
81
89
|
'/'
|
82
90
|
end
|
data/lib/clearance.rb
CHANGED
@@ -1,44 +1,7 @@
|
|
1
1
|
module Clearance
|
2
2
|
module Shoulda
|
3
|
-
|
4
3
|
# STATE OF AUTHENTICATION
|
5
4
|
|
6
|
-
def should_be_signed_in_as(&block)
|
7
|
-
warn "[DEPRECATION] should_be_signed_in_as cannot be used in functional tests anymore now that it depends on cookies, which are unavailable until the next request."
|
8
|
-
should "be signed in as #{block.bind(self).call}" do
|
9
|
-
user = block.bind(self).call
|
10
|
-
assert_not_nil user,
|
11
|
-
"please pass a User. try: should_be_signed_in_as { @user }"
|
12
|
-
assert_equal user, @controller.send(:current_user),
|
13
|
-
"#{user.inspect} is not the current_user, " <<
|
14
|
-
"which is #{@controller.send(:current_user).inspect}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def should_be_signed_in_and_email_confirmed_as(&block)
|
19
|
-
warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as: email confirmation is gone"
|
20
|
-
should_be_signed_in_as &block
|
21
|
-
end
|
22
|
-
|
23
|
-
def should_not_be_signed_in
|
24
|
-
warn "[DEPRECATION] should_not_be_signed_in is no longer a valid test since we now store a remember_token in cookies, not user_id in session"
|
25
|
-
should "not be signed in" do
|
26
|
-
assert_nil session[:user_id]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def should_deny_access_on(http_method, action, opts = {})
|
31
|
-
warn "[DEPRECATION] should_deny_access_on: use a setup & should_deny_access(:flash => ?)"
|
32
|
-
flash_message = opts.delete(:flash)
|
33
|
-
context "on #{http_method} to #{action}" do
|
34
|
-
setup do
|
35
|
-
send(http_method, action, opts)
|
36
|
-
end
|
37
|
-
|
38
|
-
should_deny_access(:flash => flash_message)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
5
|
def should_deny_access(opts = {})
|
43
6
|
if opts[:flash]
|
44
7
|
should set_the_flash.to(opts[:flash])
|
@@ -52,46 +15,7 @@ module Clearance
|
|
52
15
|
# HTTP FLUENCY
|
53
16
|
|
54
17
|
def should_forbid(description, &block)
|
55
|
-
|
56
|
-
assert_raises ActionController::Forbidden do
|
57
|
-
instance_eval(&block)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# CONTEXTS
|
63
|
-
|
64
|
-
def signed_in_user_context(&blk)
|
65
|
-
warn "[DEPRECATION] signed_in_user_context: creates a Mystery Guest, causes Obscure Test"
|
66
|
-
context "A signed in user" do
|
67
|
-
setup do
|
68
|
-
@user = Factory(:user)
|
69
|
-
@user.confirm_email!
|
70
|
-
sign_in_as @user
|
71
|
-
end
|
72
|
-
merge_block(&blk)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def public_context(&blk)
|
77
|
-
warn "[DEPRECATION] public_context: common case is no-op. call sign_out otherwise"
|
78
|
-
context "The public" do
|
79
|
-
setup { sign_out }
|
80
|
-
merge_block(&blk)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# CREATING USERS
|
85
|
-
|
86
|
-
def should_create_user_successfully
|
87
|
-
warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally"
|
88
|
-
should assign_to(:user)
|
89
|
-
should_change 'User.count', :by => 1
|
90
|
-
|
91
|
-
should have_sent_email.with_subject(/account confirmation/i)
|
92
|
-
|
93
|
-
should set_the_flash.to(/confirm/i)
|
94
|
-
should_redirect_to_url_after_create
|
18
|
+
warn "[DEPRECATION] should_forbid and Clearance's ActionController::Forbidden have been removed. Setting the 403 status code turned out to be an awful user experience in some browsers such as Chrome on Windows machines."
|
95
19
|
end
|
96
20
|
|
97
21
|
# RENDERING
|
@@ -119,87 +43,6 @@ module Clearance
|
|
119
43
|
def should_redirect_to_url_already_confirmed
|
120
44
|
should redirect_to("the already confirmed url") { @controller.send(:url_already_confirmed) }
|
121
45
|
end
|
122
|
-
|
123
|
-
# VALIDATIONS
|
124
|
-
|
125
|
-
def should_validate_confirmation_of(attribute, opts = {})
|
126
|
-
warn "[DEPRECATION] should_validate_confirmation_of: not meant to be public, no longer used internally"
|
127
|
-
raise ArgumentError if opts[:factory].nil?
|
128
|
-
|
129
|
-
context "on save" do
|
130
|
-
should_validate_confirmation_is_not_blank opts[:factory], attribute
|
131
|
-
should_validate_confirmation_is_not_bad opts[:factory], attribute
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def should_validate_confirmation_is_not_blank(factory, attribute, opts = {})
|
136
|
-
warn "[DEPRECATION] should_validate_confirmation_is_not_blank: not meant to be public, no longer used internally"
|
137
|
-
should "validate #{attribute}_confirmation is not blank" do
|
138
|
-
model = Factory.build(factory, blank_confirmation_options(attribute))
|
139
|
-
model.save
|
140
|
-
assert_confirmation_error(model, attribute,
|
141
|
-
"#{attribute}_confirmation cannot be blank")
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def should_validate_confirmation_is_not_bad(factory, attribute, opts = {})
|
146
|
-
warn "[DEPRECATION] should_validate_confirmation_is_not_bad: not meant to be public, no longer used internally"
|
147
|
-
should "validate #{attribute}_confirmation is different than #{attribute}" do
|
148
|
-
model = Factory.build(factory, bad_confirmation_options(attribute))
|
149
|
-
model.save
|
150
|
-
assert_confirmation_error(model, attribute,
|
151
|
-
"#{attribute}_confirmation cannot be different than #{attribute}")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# FORMS
|
156
|
-
|
157
|
-
def should_display_a_password_update_form
|
158
|
-
warn "[DEPRECATION] should_display_a_password_update_form: not meant to be public, no longer used internally"
|
159
|
-
should "have a form for the user's token, password, and password confirm" do
|
160
|
-
update_path = ERB::Util.h(
|
161
|
-
user_password_path(@user, :token => @user.confirmation_token)
|
162
|
-
)
|
163
|
-
|
164
|
-
assert_select 'form[action=?]', update_path do
|
165
|
-
assert_select 'input[name=_method][value=?]', 'put'
|
166
|
-
assert_select 'input[name=?]', 'user[password]'
|
167
|
-
assert_select 'input[name=?]', 'user[password_confirmation]'
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def should_display_a_sign_up_form
|
173
|
-
warn "[DEPRECATION] should_display_a_sign_up_form: not meant to be public, no longer used internally"
|
174
|
-
should "display a form to sign up" do
|
175
|
-
assert_select "form[action=#{users_path}][method=post]",
|
176
|
-
true, "There must be a form to sign up" do
|
177
|
-
assert_select "input[type=text][name=?]",
|
178
|
-
"user[email]", true, "There must be an email field"
|
179
|
-
assert_select "input[type=password][name=?]",
|
180
|
-
"user[password]", true, "There must be a password field"
|
181
|
-
assert_select "input[type=password][name=?]",
|
182
|
-
"user[password_confirmation]", true, "There must be a password confirmation field"
|
183
|
-
assert_select "input[type=submit]", true,
|
184
|
-
"There must be a submit button"
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def should_display_a_sign_in_form
|
190
|
-
warn "[DEPRECATION] should_display_a_sign_in_form: not meant to be public, no longer used internally"
|
191
|
-
should 'display a "sign in" form' do
|
192
|
-
assert_select "form[action=#{session_path}][method=post]",
|
193
|
-
true, "There must be a form to sign in" do
|
194
|
-
assert_select "input[type=text][name=?]",
|
195
|
-
"session[email]", true, "There must be an email field"
|
196
|
-
assert_select "input[type=password][name=?]",
|
197
|
-
"session[password]", true, "There must be a password field"
|
198
|
-
assert_select "input[type=submit]", true,
|
199
|
-
"There must be a submit button"
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
46
|
end
|
204
47
|
end
|
205
48
|
|
@@ -218,24 +61,6 @@ module Clearance
|
|
218
61
|
def sign_out
|
219
62
|
@controller.current_user = nil
|
220
63
|
end
|
221
|
-
|
222
|
-
def blank_confirmation_options(attribute)
|
223
|
-
warn "[DEPRECATION] blank_confirmation_options: not meant to be public, no longer used internally"
|
224
|
-
opts = { attribute => attribute.to_s }
|
225
|
-
opts.merge("#{attribute}_confirmation".to_sym => "")
|
226
|
-
end
|
227
|
-
|
228
|
-
def bad_confirmation_options(attribute)
|
229
|
-
warn "[DEPRECATION] bad_confirmation_options: not meant to be public, no longer used internally"
|
230
|
-
opts = { attribute => attribute.to_s }
|
231
|
-
opts.merge("#{attribute}_confirmation".to_sym => "not_#{attribute}")
|
232
|
-
end
|
233
|
-
|
234
|
-
def assert_confirmation_error(model, attribute, message = "confirmation error")
|
235
|
-
warn "[DEPRECATION] assert_confirmation_error: not meant to be public, no longer used internally"
|
236
|
-
assert model.errors[attribute].include?("doesn't match confirmation"),
|
237
|
-
message
|
238
|
-
end
|
239
64
|
end
|
240
65
|
end
|
241
66
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
Feature: Password reset
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
In order to sign in even if I forgot my password
|
4
|
+
As a user
|
5
|
+
I want to reset my password
|
5
6
|
|
6
7
|
Scenario: User is not signed up
|
7
8
|
Given no user exists with an email of "email@person.com"
|
@@ -1,7 +1,8 @@
|
|
1
1
|
Feature: Sign out
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
In order to protect my account from unauthorized access
|
4
|
+
As a signed in user
|
5
|
+
I want to sign out
|
5
6
|
|
6
7
|
Scenario: User signs out
|
7
8
|
Given I am signed up as "email@person.com/password"
|
data/lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb
CHANGED
@@ -14,17 +14,13 @@ Given /^no user exists with an email of "(.*)"$/ do |email|
|
|
14
14
|
assert_nil User.find_by_email(email)
|
15
15
|
end
|
16
16
|
|
17
|
-
Given /^I signed up with "(.*)\/(.*)"$/ do |email, password|
|
17
|
+
Given /^(?:I am|I have|I) signed up (?:as|with) "(.*)\/(.*)"$/ do |email, password|
|
18
18
|
Factory(:user,
|
19
19
|
:email => email,
|
20
20
|
:password => password,
|
21
21
|
:password_confirmation => password)
|
22
22
|
end
|
23
23
|
|
24
|
-
Given /^I am signed up as "([^"]+)"$/ do |email_password|
|
25
|
-
Given %{I signed up with "#{email_password}"}
|
26
|
-
end
|
27
|
-
|
28
24
|
# Session
|
29
25
|
|
30
26
|
Then /^I should be signed in$/ do
|
@@ -44,7 +40,7 @@ When /^session is cleared$/ do
|
|
44
40
|
#controller.instance_variable_set(:@_current_user, nil)
|
45
41
|
end
|
46
42
|
|
47
|
-
Given /^I have signed in with "(.*)\/(.*)"$/ do |email, password|
|
43
|
+
Given /^(?:I am|I have|I) signed in (?:with|as) "(.*)\/(.*)"$/ do |email, password|
|
48
44
|
Given %{I am signed up as "#{email}/#{password}"}
|
49
45
|
And %{I sign in as "#{email}/#{password}"}
|
50
46
|
end
|
@@ -79,10 +75,6 @@ When /^I try to change the password of "(.*)" without token$/ do |email|
|
|
79
75
|
visit edit_user_password_path(:user_id => user)
|
80
76
|
end
|
81
77
|
|
82
|
-
Then /^I should be forbidden$/ do
|
83
|
-
assert_response :forbidden
|
84
|
-
end
|
85
|
-
|
86
78
|
# Actions
|
87
79
|
|
88
80
|
When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
|
@@ -0,0 +1,143 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../..
|
3
|
+
specs:
|
4
|
+
clearance (0.9.0.rc9)
|
5
|
+
rails (~> 3.0.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
abstract (1.0.0)
|
11
|
+
actionmailer (3.0.0)
|
12
|
+
actionpack (= 3.0.0)
|
13
|
+
mail (~> 2.2.5)
|
14
|
+
actionpack (3.0.0)
|
15
|
+
activemodel (= 3.0.0)
|
16
|
+
activesupport (= 3.0.0)
|
17
|
+
builder (~> 2.1.2)
|
18
|
+
erubis (~> 2.6.6)
|
19
|
+
i18n (~> 0.4.1)
|
20
|
+
rack (~> 1.2.1)
|
21
|
+
rack-mount (~> 0.6.12)
|
22
|
+
rack-test (~> 0.5.4)
|
23
|
+
tzinfo (~> 0.3.23)
|
24
|
+
activemodel (3.0.0)
|
25
|
+
activesupport (= 3.0.0)
|
26
|
+
builder (~> 2.1.2)
|
27
|
+
i18n (~> 0.4.1)
|
28
|
+
activerecord (3.0.0)
|
29
|
+
activemodel (= 3.0.0)
|
30
|
+
activesupport (= 3.0.0)
|
31
|
+
arel (~> 1.0.0)
|
32
|
+
tzinfo (~> 0.3.23)
|
33
|
+
activeresource (3.0.0)
|
34
|
+
activemodel (= 3.0.0)
|
35
|
+
activesupport (= 3.0.0)
|
36
|
+
activesupport (3.0.0)
|
37
|
+
arel (1.0.1)
|
38
|
+
activesupport (~> 3.0.0)
|
39
|
+
builder (2.1.2)
|
40
|
+
capybara (0.4.0)
|
41
|
+
celerity (>= 0.7.9)
|
42
|
+
culerity (>= 0.2.4)
|
43
|
+
mime-types (>= 1.16)
|
44
|
+
nokogiri (>= 1.3.3)
|
45
|
+
rack (>= 1.0.0)
|
46
|
+
rack-test (>= 0.5.4)
|
47
|
+
selenium-webdriver (>= 0.0.27)
|
48
|
+
xpath (~> 0.1.2)
|
49
|
+
celerity (0.8.6)
|
50
|
+
childprocess (0.1.4)
|
51
|
+
ffi (~> 0.6.3)
|
52
|
+
configuration (1.1.0)
|
53
|
+
cucumber (0.10.0)
|
54
|
+
builder (>= 2.1.2)
|
55
|
+
diff-lcs (~> 1.1.2)
|
56
|
+
gherkin (~> 2.3.2)
|
57
|
+
json (~> 1.4.6)
|
58
|
+
term-ansicolor (~> 1.0.5)
|
59
|
+
cucumber-rails (0.3.2)
|
60
|
+
cucumber (>= 0.8.0)
|
61
|
+
culerity (0.2.13)
|
62
|
+
diff-lcs (1.1.2)
|
63
|
+
erubis (2.6.6)
|
64
|
+
abstract (>= 1.0.0)
|
65
|
+
factory_girl (1.3.2)
|
66
|
+
factory_girl_rails (1.0)
|
67
|
+
factory_girl (~> 1.3)
|
68
|
+
rails (>= 3.0.0.beta4)
|
69
|
+
ffi (0.6.3)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
formtastic (1.1.0.beta)
|
72
|
+
actionpack (>= 2.3.0)
|
73
|
+
activesupport (>= 2.3.0)
|
74
|
+
i18n (>= 0.4.0)
|
75
|
+
gherkin (2.3.2)
|
76
|
+
json (~> 1.4.6)
|
77
|
+
term-ansicolor (~> 1.0.5)
|
78
|
+
i18n (0.4.1)
|
79
|
+
json (1.4.6)
|
80
|
+
json_pure (1.4.6)
|
81
|
+
launchy (0.3.7)
|
82
|
+
configuration (>= 0.0.5)
|
83
|
+
rake (>= 0.8.1)
|
84
|
+
mail (2.2.5)
|
85
|
+
activesupport (>= 2.3.6)
|
86
|
+
mime-types
|
87
|
+
treetop (>= 1.4.5)
|
88
|
+
mime-types (1.16)
|
89
|
+
mocha (0.9.8)
|
90
|
+
rake
|
91
|
+
nokogiri (1.4.1)
|
92
|
+
polyglot (0.3.1)
|
93
|
+
rack (1.2.1)
|
94
|
+
rack-mount (0.6.13)
|
95
|
+
rack (>= 1.0.0)
|
96
|
+
rack-test (0.5.4)
|
97
|
+
rack (>= 1.0)
|
98
|
+
rails (3.0.0)
|
99
|
+
actionmailer (= 3.0.0)
|
100
|
+
actionpack (= 3.0.0)
|
101
|
+
activerecord (= 3.0.0)
|
102
|
+
activeresource (= 3.0.0)
|
103
|
+
activesupport (= 3.0.0)
|
104
|
+
bundler (~> 1.0.0)
|
105
|
+
railties (= 3.0.0)
|
106
|
+
railties (3.0.0)
|
107
|
+
actionpack (= 3.0.0)
|
108
|
+
activesupport (= 3.0.0)
|
109
|
+
rake (>= 0.8.4)
|
110
|
+
thor (~> 0.14.0)
|
111
|
+
rake (0.8.7)
|
112
|
+
rubyzip (0.9.4)
|
113
|
+
selenium-webdriver (0.1.1)
|
114
|
+
childprocess (= 0.1.4)
|
115
|
+
ffi (~> 0.6.3)
|
116
|
+
json_pure
|
117
|
+
rubyzip
|
118
|
+
shoulda (2.11.3)
|
119
|
+
sqlite3-ruby (1.3.1)
|
120
|
+
term-ansicolor (1.0.5)
|
121
|
+
thor (0.14.0)
|
122
|
+
treetop (1.4.8)
|
123
|
+
polyglot (>= 0.3.1)
|
124
|
+
tzinfo (0.3.23)
|
125
|
+
xpath (0.1.2)
|
126
|
+
nokogiri (~> 1.3)
|
127
|
+
|
128
|
+
PLATFORMS
|
129
|
+
ruby
|
130
|
+
|
131
|
+
DEPENDENCIES
|
132
|
+
capybara (= 0.4.0)
|
133
|
+
clearance!
|
134
|
+
cucumber (= 0.10.0)
|
135
|
+
cucumber-rails (= 0.3.2)
|
136
|
+
factory_girl_rails (= 1.0)
|
137
|
+
formtastic (= 1.1.0.beta)
|
138
|
+
launchy (= 0.3.7)
|
139
|
+
mocha (= 0.9.8)
|
140
|
+
nokogiri (= 1.4.1)
|
141
|
+
rails (= 3.0.0)
|
142
|
+
shoulda (= 2.11.3)
|
143
|
+
sqlite3-ruby
|