clearance 0.9.0.rc1 → 0.9.0.rc2
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/README.md +5 -1
- data/lib/clearance/engine.rb +0 -1
- data/shoulda_macros/clearance.rb +2 -6
- data/test/controllers/confirmations_controller_test.rb +4 -1
- data/test/controllers/passwords_controller_test.rb +7 -11
- data/test/controllers/sessions_controller_test.rb +2 -4
- data/test/controllers/users_controller_test.rb +8 -9
- data/test/models/user_test.rb +5 -10
- metadata +3 -3
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Fork away and create a [Github Issue](http://github.com/thoughtbot/clearance/iss
|
|
20
20
|
Installation
|
21
21
|
------------
|
22
22
|
|
23
|
-
Clearance is a Rails engine. The latest stable version works with versions of Rails
|
23
|
+
Clearance is a Rails engine. The latest stable version (0.8.8) works with versions of Rails 2.x.
|
24
24
|
|
25
25
|
Install it as a gem however you like to install gems. Also, uninstall old versions:
|
26
26
|
|
@@ -38,6 +38,10 @@ This:
|
|
38
38
|
* inserts Clearance::Authentication into your ApplicationController
|
39
39
|
* created a migration that either creates a users table or adds only missing columns
|
40
40
|
|
41
|
+
There is a release candidate which features Rails 3 support. To install this version:
|
42
|
+
|
43
|
+
gem install clearance --prerelease
|
44
|
+
|
41
45
|
Usage
|
42
46
|
-----
|
43
47
|
|
data/lib/clearance/engine.rb
CHANGED
data/shoulda_macros/clearance.rb
CHANGED
@@ -93,14 +93,10 @@ module Clearance
|
|
93
93
|
|
94
94
|
def should_create_user_successfully
|
95
95
|
warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally"
|
96
|
-
|
96
|
+
should assign_to(:user)
|
97
97
|
should_change 'User.count', :by => 1
|
98
98
|
|
99
|
-
should
|
100
|
-
assert_sent_email do |email|
|
101
|
-
email.subject =~ /account confirmation/i
|
102
|
-
end
|
103
|
-
end
|
99
|
+
should have_sent_email.with_subject(/account confirmation/i)
|
104
100
|
|
105
101
|
should set_the_flash.to(/confirm/i)
|
106
102
|
should_redirect_to_url_after_create
|
@@ -89,8 +89,11 @@ class ConfirmationsControllerTest < ActionController::TestCase
|
|
89
89
|
|
90
90
|
should set_the_flash.to(/already confirmed/i)
|
91
91
|
should set_the_flash.to(/sign in/i)
|
92
|
-
should_not_be_signed_in
|
93
92
|
should_redirect_to_url_already_confirmed
|
93
|
+
|
94
|
+
should "not be signed in" do
|
95
|
+
assert_nil cookies[:remember_token]
|
96
|
+
end
|
94
97
|
end
|
95
98
|
|
96
99
|
context "no users" do
|
@@ -4,8 +4,8 @@ class PasswordsControllerTest < ActionController::TestCase
|
|
4
4
|
|
5
5
|
tests Clearance::PasswordsController
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
should route(:get, '/users/1/password/edit').
|
8
|
+
to(:controller => 'clearance/passwords', :action => 'edit', :user_id => '1')
|
9
9
|
|
10
10
|
context "a signed up user" do
|
11
11
|
setup do
|
@@ -30,11 +30,7 @@ class PasswordsControllerTest < ActionController::TestCase
|
|
30
30
|
assert_not_nil @user.reload.confirmation_token
|
31
31
|
end
|
32
32
|
|
33
|
-
should
|
34
|
-
assert_sent_email do |email|
|
35
|
-
email.subject =~ /change your password/i
|
36
|
-
end
|
37
|
-
end
|
33
|
+
should have_sent_email.with_subject(/change your password/i)
|
38
34
|
|
39
35
|
should set_the_flash.to(/password/i)
|
40
36
|
should_redirect_to_url_after_create
|
@@ -87,7 +83,6 @@ class PasswordsControllerTest < ActionController::TestCase
|
|
87
83
|
|
88
84
|
should respond_with(:success)
|
89
85
|
should render_template(:edit)
|
90
|
-
should_display_a_password_update_form
|
91
86
|
end
|
92
87
|
|
93
88
|
should_forbid "on GET to #edit with correct id but blank token" do
|
@@ -155,12 +150,13 @@ class PasswordsControllerTest < ActionController::TestCase
|
|
155
150
|
assert_not_nil @user.confirmation_token
|
156
151
|
end
|
157
152
|
|
158
|
-
|
153
|
+
should "not be signed in" do
|
154
|
+
assert_nil cookies[:remember_token]
|
155
|
+
end
|
156
|
+
|
159
157
|
should_not set_the_flash
|
160
158
|
should respond_with(:success)
|
161
159
|
should render_template(:edit)
|
162
|
-
|
163
|
-
should_display_a_password_update_form
|
164
160
|
end
|
165
161
|
|
166
162
|
should_forbid "on PUT to #update with id but no token" do
|
@@ -11,7 +11,6 @@ class SessionsControllerTest < ActionController::TestCase
|
|
11
11
|
should respond_with(:success)
|
12
12
|
should render_template(:new)
|
13
13
|
should_not set_the_flash
|
14
|
-
should_display_a_sign_in_form
|
15
14
|
end
|
16
15
|
|
17
16
|
context "on POST to #create with unconfirmed credentials" do
|
@@ -144,10 +143,9 @@ class SessionsControllerTest < ActionController::TestCase
|
|
144
143
|
should set_the_flash.to(/bad/i)
|
145
144
|
should respond_with(:unauthorized)
|
146
145
|
should render_template(:new)
|
147
|
-
should_not_be_signed_in
|
148
146
|
|
149
|
-
should
|
150
|
-
assert_nil cookies[
|
147
|
+
should "not be signed in" do
|
148
|
+
assert_nil cookies[:remember_token]
|
151
149
|
end
|
152
150
|
end
|
153
151
|
|
@@ -15,8 +15,6 @@ class UsersControllerTest < ActionController::TestCase
|
|
15
15
|
should respond_with(:success)
|
16
16
|
should render_template(:new)
|
17
17
|
should_not set_the_flash
|
18
|
-
|
19
|
-
should_display_a_sign_up_form
|
20
18
|
end
|
21
19
|
|
22
20
|
context "on GET to #new with email" do
|
@@ -37,24 +35,25 @@ class UsersControllerTest < ActionController::TestCase
|
|
37
35
|
post :create, :user => user_attributes
|
38
36
|
end
|
39
37
|
|
40
|
-
|
38
|
+
should assign_to(:user)
|
41
39
|
|
42
40
|
should "create a new user" do
|
43
41
|
assert_equal @old_user_count + 1, User.count
|
44
42
|
end
|
45
43
|
|
46
|
-
should
|
47
|
-
assert_sent_email do |email|
|
48
|
-
email.subject =~ /account confirmation/i
|
49
|
-
end
|
50
|
-
end
|
44
|
+
should have_sent_email.with_subject(/account confirmation/i)
|
51
45
|
|
52
46
|
should set_the_flash.to(/confirm/i)
|
53
47
|
should_redirect_to_url_after_create
|
54
48
|
end
|
55
49
|
end
|
56
50
|
|
57
|
-
|
51
|
+
context "A signed-in user" do
|
52
|
+
setup do
|
53
|
+
@user = Factory(:email_confirmed_user)
|
54
|
+
sign_in_as @user
|
55
|
+
end
|
56
|
+
|
58
57
|
context "GET to new" do
|
59
58
|
setup { get :new }
|
60
59
|
should redirect_to("the home page") { root_url }
|
data/test/models/user_test.rb
CHANGED
@@ -10,7 +10,8 @@ class UserTest < ActiveSupport::TestCase
|
|
10
10
|
# signing up
|
11
11
|
|
12
12
|
context "When signing up" do
|
13
|
-
|
13
|
+
should validate_presence_of(:email)
|
14
|
+
should validate_presence_of(:password)
|
14
15
|
should allow_value("foo@example.com").for(:email)
|
15
16
|
should_not allow_value("foo").for(:email)
|
16
17
|
should_not allow_value("example.com").for(:email)
|
@@ -59,11 +60,7 @@ class UserTest < ActiveSupport::TestCase
|
|
59
60
|
assert_equal "John.Doe@example.com", user.email
|
60
61
|
end
|
61
62
|
|
62
|
-
should
|
63
|
-
assert_sent_email do |email|
|
64
|
-
email.subject =~ /account confirmation/i
|
65
|
-
end
|
66
|
-
end
|
63
|
+
should have_sent_email.with_subject(/account confirmation/i)
|
67
64
|
end
|
68
65
|
|
69
66
|
context "When signing up with email already confirmed" do
|
@@ -72,14 +69,12 @@ class UserTest < ActiveSupport::TestCase
|
|
72
69
|
Factory(:user, :email_confirmed => true)
|
73
70
|
end
|
74
71
|
|
75
|
-
|
76
|
-
assert_did_not_send_email
|
77
|
-
end
|
72
|
+
should_not have_sent_email
|
78
73
|
end
|
79
74
|
|
80
75
|
context "When multiple users have signed up" do
|
81
76
|
setup { Factory(:user) }
|
82
|
-
|
77
|
+
should validate_uniqueness_of(:email)
|
83
78
|
end
|
84
79
|
|
85
80
|
# confirming email
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 977940487
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.9.0.
|
10
|
+
- rc2
|
11
|
+
version: 0.9.0.rc2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Dan Croak
|