clearance 0.14.0 → 0.15.0

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 ADDED
@@ -0,0 +1,26 @@
1
+ 2012-02-03 Mike Burns <mburns@thoughtbot.com>
2
+
3
+ * Gemfile, clearance.gemspec, 3.1.0.gemfile, 3.0.9.gemfile:
4
+ Upgrade cucumber-rails, which requires use of the #steps method.
5
+ * VERSION:
6
+ Bump to 0.15.0
7
+
8
+ 2012-02-02 Gabe Berke-Williams <gabe@thoughtbot.com>
9
+
10
+ * user.rb:
11
+ Remove InstanceMethods module. It's deprecated in 3.2 and unnecessary in all
12
+ versions.
13
+
14
+ 2012-01-16 Matthew Daubert <mdaubert@gmail.com>
15
+
16
+ * clearance_steps.rb:
17
+ `When` is deprecated in step definitions, changed to `step`.
18
+
19
+ 2011-12-01 Dan Hodge <dan@swipely.com>
20
+
21
+ * Rakefile, passwords_controller.rb, users_controller.rb, authentication.rb,
22
+ configuration.rb, configuration_spec.rb, passwords_controller_spec.rb,
23
+ session.rb:
24
+ Optional config param 'user_model_name' added
25
+ Defer user_model load so it can be a constant
26
+ Find user via the configured user model class
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem "capybara", "~> 1.0.0"
4
+ gem "capybara", "~> 1.1.1"
5
5
  gem "factory_girl_rails"
6
6
  gem "shoulda-matchers", :git => "git://github.com/thoughtbot/shoulda-matchers.git"
7
7
  gem "database_cleaner"
data/Gemfile.lock CHANGED
@@ -1,132 +1,136 @@
1
1
  GIT
2
2
  remote: git://github.com/thoughtbot/shoulda-matchers.git
3
- revision: 5190a39bba699d4989c2500c98622b505e2de828
3
+ revision: 25c2623bb9d96cf6a446ecc141fdfefe5c4860fa
4
4
  specs:
5
- shoulda-matchers (1.0.0.beta3)
5
+ shoulda-matchers (1.0.0)
6
6
 
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- clearance (0.14.0)
10
+ clearance (0.15.0)
11
11
  diesel (~> 0.1.5)
12
12
  rails (>= 3.0)
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
16
16
  specs:
17
- abstract (1.0.0)
18
- actionmailer (3.0.9)
19
- actionpack (= 3.0.9)
20
- mail (~> 2.2.19)
21
- actionpack (3.0.9)
22
- activemodel (= 3.0.9)
23
- activesupport (= 3.0.9)
24
- builder (~> 2.1.2)
25
- erubis (~> 2.6.6)
26
- i18n (~> 0.5.0)
27
- rack (~> 1.2.1)
28
- rack-mount (~> 0.6.14)
29
- rack-test (~> 0.5.7)
30
- tzinfo (~> 0.3.23)
31
- activemodel (3.0.9)
32
- activesupport (= 3.0.9)
33
- builder (~> 2.1.2)
34
- i18n (~> 0.5.0)
35
- activerecord (3.0.9)
36
- activemodel (= 3.0.9)
37
- activesupport (= 3.0.9)
38
- arel (~> 2.0.10)
39
- tzinfo (~> 0.3.23)
40
- activeresource (3.0.9)
41
- activemodel (= 3.0.9)
42
- activesupport (= 3.0.9)
43
- activesupport (3.0.9)
17
+ actionmailer (3.2.1)
18
+ actionpack (= 3.2.1)
19
+ mail (~> 2.4.0)
20
+ actionpack (3.2.1)
21
+ activemodel (= 3.2.1)
22
+ activesupport (= 3.2.1)
23
+ builder (~> 3.0.0)
24
+ erubis (~> 2.7.0)
25
+ journey (~> 1.0.1)
26
+ rack (~> 1.4.0)
27
+ rack-cache (~> 1.1)
28
+ rack-test (~> 0.6.1)
29
+ sprockets (~> 2.1.2)
30
+ activemodel (3.2.1)
31
+ activesupport (= 3.2.1)
32
+ builder (~> 3.0.0)
33
+ activerecord (3.2.1)
34
+ activemodel (= 3.2.1)
35
+ activesupport (= 3.2.1)
36
+ arel (~> 3.0.0)
37
+ tzinfo (~> 0.3.29)
38
+ activeresource (3.2.1)
39
+ activemodel (= 3.2.1)
40
+ activesupport (= 3.2.1)
41
+ activesupport (3.2.1)
42
+ i18n (~> 0.6)
43
+ multi_json (~> 1.0)
44
44
  addressable (2.2.6)
45
45
  appraisal (0.3.8)
46
46
  bundler
47
47
  rake
48
- arel (2.0.10)
48
+ arel (3.0.0)
49
49
  aruba (0.4.6)
50
50
  bcat (>= 0.6.1)
51
51
  childprocess (>= 0.2.0)
52
52
  cucumber (>= 1.0.2)
53
53
  rdiscount (>= 1.6.8)
54
54
  rspec (>= 2.6.0)
55
- bcat (0.6.1)
55
+ bcat (0.6.2)
56
56
  rack (~> 1.0)
57
57
  bourne (1.0)
58
58
  mocha (= 0.9.8)
59
- builder (2.1.2)
60
- capybara (1.0.1)
59
+ builder (3.0.0)
60
+ capybara (1.1.2)
61
61
  mime-types (>= 1.16)
62
62
  nokogiri (>= 1.3.3)
63
63
  rack (>= 1.0.0)
64
64
  rack-test (>= 0.5.4)
65
65
  selenium-webdriver (~> 2.0)
66
66
  xpath (~> 0.1.4)
67
- childprocess (0.2.2)
67
+ childprocess (0.3.0)
68
68
  ffi (~> 1.0.6)
69
- cucumber (1.0.2)
69
+ cucumber (1.1.4)
70
70
  builder (>= 2.1.2)
71
71
  diff-lcs (>= 1.1.2)
72
- gherkin (~> 2.4.5)
72
+ gherkin (~> 2.7.1)
73
73
  json (>= 1.4.6)
74
- term-ansicolor (>= 1.0.5)
75
- cucumber-rails (1.0.2)
76
- capybara (>= 1.0.0)
77
- cucumber (~> 1.0.0)
78
- nokogiri (>= 1.4.6)
79
- database_cleaner (0.6.7)
74
+ term-ansicolor (>= 1.0.6)
75
+ cucumber-rails (1.1.1)
76
+ capybara (>= 1.1.1)
77
+ cucumber (>= 1.1.0)
78
+ nokogiri (>= 1.5.0)
79
+ database_cleaner (0.7.1)
80
80
  diesel (0.1.5)
81
81
  railties
82
82
  diff-lcs (1.1.3)
83
- erubis (2.6.6)
84
- abstract (>= 1.0.0)
85
- factory_girl (2.0.5)
86
- factory_girl_rails (1.1.0)
87
- factory_girl (~> 2.0.0)
83
+ erubis (2.7.0)
84
+ factory_girl (2.5.0)
85
+ activesupport
86
+ factory_girl_rails (1.6.0)
87
+ factory_girl (~> 2.5.0)
88
88
  railties (>= 3.0.0)
89
- ffi (1.0.9)
90
- gherkin (2.4.16)
89
+ ffi (1.0.11)
90
+ gherkin (2.7.6)
91
91
  json (>= 1.4.6)
92
- i18n (0.5.0)
93
- json (1.5.4)
94
- json_pure (1.5.4)
95
- spruz (~> 0.2.8)
92
+ hike (1.2.1)
93
+ i18n (0.6.0)
94
+ journey (1.0.1)
95
+ json (1.6.5)
96
96
  launchy (2.0.5)
97
97
  addressable (~> 2.2.6)
98
- mail (2.2.19)
99
- activesupport (>= 2.3.6)
98
+ mail (2.4.1)
100
99
  i18n (>= 0.4.0)
101
100
  mime-types (~> 1.16)
102
101
  treetop (~> 1.4.8)
103
- mime-types (1.16)
102
+ mime-types (1.17.2)
104
103
  mocha (0.9.8)
105
104
  rake
105
+ multi_json (1.0.4)
106
106
  nokogiri (1.5.0)
107
107
  polyglot (0.3.3)
108
- rack (1.2.3)
109
- rack-mount (0.6.14)
110
- rack (>= 1.0.0)
111
- rack-test (0.5.7)
108
+ rack (1.4.1)
109
+ rack-cache (1.1)
110
+ rack (>= 0.4)
111
+ rack-ssl (1.3.2)
112
+ rack
113
+ rack-test (0.6.1)
112
114
  rack (>= 1.0)
113
- rails (3.0.9)
114
- actionmailer (= 3.0.9)
115
- actionpack (= 3.0.9)
116
- activerecord (= 3.0.9)
117
- activeresource (= 3.0.9)
118
- activesupport (= 3.0.9)
115
+ rails (3.2.1)
116
+ actionmailer (= 3.2.1)
117
+ actionpack (= 3.2.1)
118
+ activerecord (= 3.2.1)
119
+ activeresource (= 3.2.1)
120
+ activesupport (= 3.2.1)
119
121
  bundler (~> 1.0)
120
- railties (= 3.0.9)
121
- railties (3.0.9)
122
- actionpack (= 3.0.9)
123
- activesupport (= 3.0.9)
122
+ railties (= 3.2.1)
123
+ railties (3.2.1)
124
+ actionpack (= 3.2.1)
125
+ activesupport (= 3.2.1)
126
+ rack-ssl (~> 1.3.2)
124
127
  rake (>= 0.8.7)
125
128
  rdoc (~> 3.4)
126
- thor (~> 0.14.4)
127
- rake (0.9.2)
129
+ thor (~> 0.14.6)
130
+ rake (0.9.2.2)
128
131
  rdiscount (1.6.8)
129
- rdoc (3.7)
132
+ rdoc (3.12)
133
+ json (~> 1.4)
130
134
  rspec (2.6.0)
131
135
  rspec-core (~> 2.6.0)
132
136
  rspec-expectations (~> 2.6.0)
@@ -140,21 +144,25 @@ GEM
140
144
  activesupport (~> 3.0)
141
145
  railties (~> 3.0)
142
146
  rspec (~> 2.6.0)
143
- rubyzip (0.9.4)
144
- selenium-webdriver (2.5.0)
145
- childprocess (>= 0.2.1)
146
- ffi (>= 1.0.7)
147
- json_pure
147
+ rubyzip (0.9.5)
148
+ selenium-webdriver (2.18.0)
149
+ childprocess (>= 0.2.5)
150
+ ffi (~> 1.0.9)
151
+ multi_json (~> 1.0.4)
148
152
  rubyzip
149
- spruz (0.2.13)
150
- sqlite3 (1.3.4)
151
- term-ansicolor (1.0.6)
153
+ sprockets (2.1.2)
154
+ hike (~> 1.2)
155
+ rack (~> 1.0)
156
+ tilt (~> 1.1, != 1.3.0)
157
+ sqlite3 (1.3.5)
158
+ term-ansicolor (1.0.7)
152
159
  thor (0.14.6)
160
+ tilt (1.3.3)
153
161
  timecop (0.3.5)
154
162
  treetop (1.4.10)
155
163
  polyglot
156
164
  polyglot (>= 0.3.1)
157
- tzinfo (0.3.29)
165
+ tzinfo (0.3.31)
158
166
  xpath (0.1.4)
159
167
  nokogiri (~> 1.3)
160
168
 
@@ -166,9 +174,9 @@ DEPENDENCIES
166
174
  aruba (~> 0.4.2)
167
175
  bourne
168
176
  bundler (~> 1.0.0)
169
- capybara (~> 1.0.0)
177
+ capybara (~> 1.1.1)
170
178
  clearance!
171
- cucumber-rails (~> 1.0.2)
179
+ cucumber-rails (~> 1.1.1)
172
180
  database_cleaner
173
181
  factory_girl_rails
174
182
  launchy
data/NEWS ADDED
@@ -0,0 +1,5 @@
1
+ New for 0.15.0:
2
+
3
+ * The User model can be swapped out using the Clearance.configure method.
4
+ * Remove User::InstanceMethods to silence a Rails 3.2 deprecation warning.
5
+ * Bump development dependency of cucumber-rails to 1.1.1.
data/Rakefile CHANGED
@@ -17,9 +17,7 @@ task :all => ["appraisal:install"] do |t|
17
17
  exec('rake appraisal spec cucumber')
18
18
  end
19
19
 
20
- RSpec::Core::RakeTask.new do |t|
21
- t.pattern = 'spec/**/*_spec.rb'
22
- end
20
+ RSpec::Core::RakeTask.new(:spec)
23
21
 
24
22
  Cucumber::Rake::Task.new(:cucumber) do |t|
25
23
  t.fork = true
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.0
1
+ 0.15.0
@@ -10,7 +10,8 @@ class Clearance::PasswordsController < ApplicationController
10
10
  end
11
11
 
12
12
  def create
13
- if user = ::User.find_by_email(params[:password][:email])
13
+ if user = Clearance.configuration.user_model.find_by_email(
14
+ params[:password][:email])
14
15
  user.forgot_password!
15
16
  ::ClearanceMailer.change_password(user).deliver
16
17
  render :template => 'passwords/create'
@@ -21,13 +22,13 @@ class Clearance::PasswordsController < ApplicationController
21
22
  end
22
23
 
23
24
  def edit
24
- @user = ::User.find_by_id_and_confirmation_token(
25
+ @user = Clearance.configuration.user_model.find_by_id_and_confirmation_token(
25
26
  params[:user_id], params[:token])
26
27
  render :template => 'passwords/edit'
27
28
  end
28
29
 
29
30
  def update
30
- @user = ::User.find_by_id_and_confirmation_token(
31
+ @user = Clearance.configuration.user_model.find_by_id_and_confirmation_token(
31
32
  params[:user_id], params[:token])
32
33
 
33
34
  if @user.update_password(params[:user][:password])
@@ -49,7 +50,7 @@ class Clearance::PasswordsController < ApplicationController
49
50
  end
50
51
 
51
52
  def forbid_non_existent_user
52
- unless ::User.find_by_id_and_confirmation_token(
53
+ unless Clearance.configuration.user_model.find_by_id_and_confirmation_token(
53
54
  params[:user_id], params[:token])
54
55
  flash_failure_when_forbidden
55
56
  render :template => 'passwords/new'
@@ -5,12 +5,12 @@ class Clearance::UsersController < ApplicationController
5
5
  before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
6
6
 
7
7
  def new
8
- @user = ::User.new(params[:user])
8
+ @user = Clearance.configuration.user_model.new(params[:user])
9
9
  render :template => 'users/new'
10
10
  end
11
11
 
12
12
  def create
13
- @user = ::User.new(params[:user])
13
+ @user = Clearance.configuration.user_model.new(params[:user])
14
14
  if @user.save
15
15
  sign_in(@user)
16
16
  redirect_back_or(url_after_create)
data/clearance.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
 
28
28
  s.add_development_dependency('bundler', '~> 1.0.0')
29
29
  s.add_development_dependency('appraisal', '~> 0.3.8')
30
- s.add_development_dependency('cucumber-rails', '~> 1.0.2')
30
+ s.add_development_dependency('cucumber-rails', '~> 1.1.1')
31
31
  s.add_development_dependency('rspec-rails', '~> 2.6.0')
32
32
  s.add_development_dependency('sqlite3')
33
33
  s.add_development_dependency('bourne')
@@ -32,7 +32,7 @@ Given /^I sign in$/ do
32
32
  end
33
33
 
34
34
  When /^I sign in (?:with|as) "([^"]*)"$/ do |email|
35
- When %{I sign in with "#{email}" and "password"}
35
+ step %{I sign in with "#{email}" and "password"}
36
36
  end
37
37
 
38
38
  When /^I sign in (?:with|as) "([^"]*)" and "([^"]*)"$/ do |email, password|
@@ -6,7 +6,7 @@ gem "rails", "3.0.9"
6
6
  gem "shoulda-matchers", :git=>"git://github.com/thoughtbot/shoulda-matchers.git"
7
7
  gem "database_cleaner"
8
8
  gem "aruba", "~> 0.4.2"
9
- gem "capybara", "~> 1.0.0"
9
+ gem "capybara", "~> 1.1.1"
10
10
  gem "factory_girl_rails"
11
11
  gem "launchy"
12
12
 
@@ -1,13 +1,13 @@
1
1
  GIT
2
2
  remote: git://github.com/thoughtbot/shoulda-matchers.git
3
- revision: 5190a39bba699d4989c2500c98622b505e2de828
3
+ revision: 25c2623bb9d96cf6a446ecc141fdfefe5c4860fa
4
4
  specs:
5
- shoulda-matchers (1.0.0.beta3)
5
+ shoulda-matchers (1.0.0)
6
6
 
7
7
  PATH
8
- remote: /Users/jferris/Source/clearance
8
+ remote: /home/mike/lib/clearance
9
9
  specs:
10
- clearance (0.14.0)
10
+ clearance (0.15.0)
11
11
  diesel (~> 0.1.5)
12
12
  rails (>= 3.0)
13
13
 
@@ -46,52 +46,52 @@ GEM
46
46
  bundler
47
47
  rake
48
48
  arel (2.0.10)
49
- aruba (0.4.5)
49
+ aruba (0.4.6)
50
50
  bcat (>= 0.6.1)
51
- childprocess (>= 0.1.9)
52
- cucumber (>= 0.10.7)
51
+ childprocess (>= 0.2.0)
52
+ cucumber (>= 1.0.2)
53
53
  rdiscount (>= 1.6.8)
54
54
  rspec (>= 2.6.0)
55
- bcat (0.6.1)
55
+ bcat (0.6.2)
56
56
  rack (~> 1.0)
57
57
  bourne (1.0)
58
58
  mocha (= 0.9.8)
59
59
  builder (2.1.2)
60
- capybara (1.0.0)
60
+ capybara (1.1.2)
61
61
  mime-types (>= 1.16)
62
62
  nokogiri (>= 1.3.3)
63
63
  rack (>= 1.0.0)
64
64
  rack-test (>= 0.5.4)
65
- selenium-webdriver (~> 0.2.0)
65
+ selenium-webdriver (~> 2.0)
66
66
  xpath (~> 0.1.4)
67
- childprocess (0.1.9)
67
+ childprocess (0.3.0)
68
68
  ffi (~> 1.0.6)
69
- cucumber (1.0.0)
69
+ cucumber (1.1.4)
70
70
  builder (>= 2.1.2)
71
71
  diff-lcs (>= 1.1.2)
72
- gherkin (~> 2.4.1)
72
+ gherkin (~> 2.7.1)
73
73
  json (>= 1.4.6)
74
- term-ansicolor (>= 1.0.5)
75
- cucumber-rails (1.0.2)
76
- capybara (>= 1.0.0)
77
- cucumber (~> 1.0.0)
78
- nokogiri (>= 1.4.6)
79
- database_cleaner (0.6.7)
74
+ term-ansicolor (>= 1.0.6)
75
+ cucumber-rails (1.1.1)
76
+ capybara (>= 1.1.1)
77
+ cucumber (>= 1.1.0)
78
+ nokogiri (>= 1.5.0)
79
+ database_cleaner (0.7.1)
80
80
  diesel (0.1.5)
81
81
  railties
82
- diff-lcs (1.1.2)
82
+ diff-lcs (1.1.3)
83
83
  erubis (2.6.6)
84
84
  abstract (>= 1.0.0)
85
- factory_girl (2.0.5)
86
- factory_girl_rails (1.1.0)
87
- factory_girl (~> 2.0.0)
85
+ factory_girl (2.5.0)
86
+ activesupport
87
+ factory_girl_rails (1.6.0)
88
+ factory_girl (~> 2.5.0)
88
89
  railties (>= 3.0.0)
89
- ffi (1.0.9)
90
- gherkin (2.4.1)
90
+ ffi (1.0.11)
91
+ gherkin (2.7.6)
91
92
  json (>= 1.4.6)
92
93
  i18n (0.5.0)
93
- json (1.5.3)
94
- json_pure (1.5.2)
94
+ json (1.6.5)
95
95
  launchy (2.0.5)
96
96
  addressable (~> 2.2.6)
97
97
  mail (2.2.19)
@@ -99,12 +99,13 @@ GEM
99
99
  i18n (>= 0.4.0)
100
100
  mime-types (~> 1.16)
101
101
  treetop (~> 1.4.8)
102
- mime-types (1.16)
102
+ mime-types (1.17.2)
103
103
  mocha (0.9.8)
104
104
  rake
105
- nokogiri (1.4.6)
106
- polyglot (0.3.1)
107
- rack (1.2.3)
105
+ multi_json (1.0.4)
106
+ nokogiri (1.5.0)
107
+ polyglot (0.3.3)
108
+ rack (1.2.5)
108
109
  rack-mount (0.6.14)
109
110
  rack (>= 1.0.0)
110
111
  rack-test (0.5.7)
@@ -123,9 +124,10 @@ GEM
123
124
  rake (>= 0.8.7)
124
125
  rdoc (~> 3.4)
125
126
  thor (~> 0.14.4)
126
- rake (0.9.2)
127
+ rake (0.9.2.2)
127
128
  rdiscount (1.6.8)
128
- rdoc (3.6.1)
129
+ rdoc (3.12)
130
+ json (~> 1.4)
129
131
  rspec (2.6.0)
130
132
  rspec-core (~> 2.6.0)
131
133
  rspec-expectations (~> 2.6.0)
@@ -139,19 +141,20 @@ GEM
139
141
  activesupport (~> 3.0)
140
142
  railties (~> 3.0)
141
143
  rspec (~> 2.6.0)
142
- rubyzip (0.9.4)
143
- selenium-webdriver (0.2.1)
144
- childprocess (>= 0.1.7)
145
- ffi (>= 1.0.7)
146
- json_pure
144
+ rubyzip (0.9.5)
145
+ selenium-webdriver (2.18.0)
146
+ childprocess (>= 0.2.5)
147
+ ffi (~> 1.0.9)
148
+ multi_json (~> 1.0.4)
147
149
  rubyzip
148
- sqlite3 (1.3.3)
149
- term-ansicolor (1.0.5)
150
+ sqlite3 (1.3.5)
151
+ term-ansicolor (1.0.7)
150
152
  thor (0.14.6)
151
153
  timecop (0.3.5)
152
- treetop (1.4.9)
154
+ treetop (1.4.10)
155
+ polyglot
153
156
  polyglot (>= 0.3.1)
154
- tzinfo (0.3.28)
157
+ tzinfo (0.3.31)
155
158
  xpath (0.1.4)
156
159
  nokogiri (~> 1.3)
157
160
 
@@ -163,9 +166,9 @@ DEPENDENCIES
163
166
  aruba (~> 0.4.2)
164
167
  bourne
165
168
  bundler (~> 1.0.0)
166
- capybara (~> 1.0.0)
169
+ capybara (~> 1.1.1)
167
170
  clearance!
168
- cucumber-rails (~> 1.0.2)
171
+ cucumber-rails (~> 1.1.1)
169
172
  database_cleaner
170
173
  factory_girl_rails
171
174
  launchy
@@ -6,7 +6,7 @@ gem "rails", "3.1.0"
6
6
  gem "shoulda-matchers", :git=>"git://github.com/thoughtbot/shoulda-matchers.git"
7
7
  gem "database_cleaner"
8
8
  gem "aruba", "~> 0.4.2"
9
- gem "capybara", "~> 1.0.0"
9
+ gem "capybara", "~> 1.1.1"
10
10
  gem "factory_girl_rails"
11
11
  gem "launchy"
12
12
 
@@ -1,13 +1,13 @@
1
1
  GIT
2
2
  remote: git://github.com/thoughtbot/shoulda-matchers.git
3
- revision: 5190a39bba699d4989c2500c98622b505e2de828
3
+ revision: 25c2623bb9d96cf6a446ecc141fdfefe5c4860fa
4
4
  specs:
5
- shoulda-matchers (1.0.0.beta3)
5
+ shoulda-matchers (1.0.0)
6
6
 
7
7
  PATH
8
- remote: /Users/jferris/Source/clearance
8
+ remote: /home/mike/lib/clearance
9
9
  specs:
10
- clearance (0.14.0)
10
+ clearance (0.15.0)
11
11
  diesel (~> 0.1.5)
12
12
  rails (>= 3.0)
13
13
 
@@ -54,61 +54,60 @@ GEM
54
54
  cucumber (>= 1.0.2)
55
55
  rdiscount (>= 1.6.8)
56
56
  rspec (>= 2.6.0)
57
- bcat (0.6.1)
57
+ bcat (0.6.2)
58
58
  rack (~> 1.0)
59
- bcrypt-ruby (3.0.0)
59
+ bcrypt-ruby (3.0.1)
60
60
  bourne (1.0)
61
61
  mocha (= 0.9.8)
62
62
  builder (3.0.0)
63
- capybara (1.0.1)
63
+ capybara (1.1.2)
64
64
  mime-types (>= 1.16)
65
65
  nokogiri (>= 1.3.3)
66
66
  rack (>= 1.0.0)
67
67
  rack-test (>= 0.5.4)
68
68
  selenium-webdriver (~> 2.0)
69
69
  xpath (~> 0.1.4)
70
- childprocess (0.2.2)
70
+ childprocess (0.3.0)
71
71
  ffi (~> 1.0.6)
72
- cucumber (1.0.2)
72
+ cucumber (1.1.4)
73
73
  builder (>= 2.1.2)
74
74
  diff-lcs (>= 1.1.2)
75
- gherkin (~> 2.4.5)
75
+ gherkin (~> 2.7.1)
76
76
  json (>= 1.4.6)
77
- term-ansicolor (>= 1.0.5)
78
- cucumber-rails (1.0.2)
79
- capybara (>= 1.0.0)
80
- cucumber (~> 1.0.0)
81
- nokogiri (>= 1.4.6)
82
- database_cleaner (0.6.7)
77
+ term-ansicolor (>= 1.0.6)
78
+ cucumber-rails (1.1.1)
79
+ capybara (>= 1.1.1)
80
+ cucumber (>= 1.1.0)
81
+ nokogiri (>= 1.5.0)
82
+ database_cleaner (0.7.1)
83
83
  diesel (0.1.5)
84
84
  railties
85
85
  diff-lcs (1.1.3)
86
86
  erubis (2.7.0)
87
- factory_girl (2.0.5)
88
- factory_girl_rails (1.1.0)
89
- factory_girl (~> 2.0.0)
87
+ factory_girl (2.5.0)
88
+ activesupport
89
+ factory_girl_rails (1.6.0)
90
+ factory_girl (~> 2.5.0)
90
91
  railties (>= 3.0.0)
91
- ffi (1.0.9)
92
- gherkin (2.4.16)
92
+ ffi (1.0.11)
93
+ gherkin (2.7.6)
93
94
  json (>= 1.4.6)
94
95
  hike (1.2.1)
95
96
  i18n (0.6.0)
96
- json (1.5.4)
97
- json_pure (1.5.4)
98
- spruz (~> 0.2.8)
97
+ json (1.6.5)
99
98
  launchy (2.0.5)
100
99
  addressable (~> 2.2.6)
101
100
  mail (2.3.0)
102
101
  i18n (>= 0.4.0)
103
102
  mime-types (~> 1.16)
104
103
  treetop (~> 1.4.8)
105
- mime-types (1.16)
104
+ mime-types (1.17.2)
106
105
  mocha (0.9.8)
107
106
  rake
108
- multi_json (1.0.3)
107
+ multi_json (1.0.4)
109
108
  nokogiri (1.5.0)
110
- polyglot (0.3.2)
111
- rack (1.3.2)
109
+ polyglot (0.3.3)
110
+ rack (1.3.6)
112
111
  rack-cache (1.0.3)
113
112
  rack (>= 0.4)
114
113
  rack-mount (0.8.3)
@@ -132,9 +131,10 @@ GEM
132
131
  rake (>= 0.8.7)
133
132
  rdoc (~> 3.4)
134
133
  thor (~> 0.14.6)
135
- rake (0.9.2)
134
+ rake (0.9.2.2)
136
135
  rdiscount (1.6.8)
137
- rdoc (3.9.4)
136
+ rdoc (3.12)
137
+ json (~> 1.4)
138
138
  rspec (2.6.0)
139
139
  rspec-core (~> 2.6.0)
140
140
  rspec-expectations (~> 2.6.0)
@@ -148,26 +148,25 @@ GEM
148
148
  activesupport (~> 3.0)
149
149
  railties (~> 3.0)
150
150
  rspec (~> 2.6.0)
151
- rubyzip (0.9.4)
152
- selenium-webdriver (2.5.0)
153
- childprocess (>= 0.2.1)
154
- ffi (>= 1.0.7)
155
- json_pure
151
+ rubyzip (0.9.5)
152
+ selenium-webdriver (2.18.0)
153
+ childprocess (>= 0.2.5)
154
+ ffi (~> 1.0.9)
155
+ multi_json (~> 1.0.4)
156
156
  rubyzip
157
- sprockets (2.0.0)
157
+ sprockets (2.0.3)
158
158
  hike (~> 1.2)
159
159
  rack (~> 1.0)
160
160
  tilt (~> 1.1, != 1.3.0)
161
- spruz (0.2.13)
162
- sqlite3 (1.3.4)
163
- term-ansicolor (1.0.6)
161
+ sqlite3 (1.3.5)
162
+ term-ansicolor (1.0.7)
164
163
  thor (0.14.6)
165
164
  tilt (1.3.3)
166
165
  timecop (0.3.5)
167
166
  treetop (1.4.10)
168
167
  polyglot
169
168
  polyglot (>= 0.3.1)
170
- tzinfo (0.3.29)
169
+ tzinfo (0.3.31)
171
170
  xpath (0.1.4)
172
171
  nokogiri (~> 1.3)
173
172
 
@@ -179,9 +178,9 @@ DEPENDENCIES
179
178
  aruba (~> 0.4.2)
180
179
  bourne
181
180
  bundler (~> 1.0.0)
182
- capybara (~> 1.0.0)
181
+ capybara (~> 1.1.1)
183
182
  clearance!
184
- cucumber-rails (~> 1.0.2)
183
+ cucumber-rails (~> 1.1.1)
185
184
  database_cleaner
186
185
  factory_girl_rails
187
186
  launchy
@@ -64,8 +64,8 @@ module Clearance
64
64
  # @example
65
65
  # @user = authenticate(params)
66
66
  def authenticate(params)
67
- ::User.authenticate(params[:session][:email],
68
- params[:session][:password])
67
+ Clearance.configuration.user_model.authenticate(params[:session][:email],
68
+ params[:session][:password])
69
69
  end
70
70
 
71
71
  # Deny the user access if they are signed out.
@@ -1,11 +1,15 @@
1
1
  module Clearance
2
2
  class Configuration
3
- attr_accessor :mailer_sender, :cookie_expiration, :password_strategy
3
+ attr_accessor :mailer_sender, :cookie_expiration, :password_strategy, :user_model
4
4
 
5
5
  def initialize
6
6
  @mailer_sender = 'donotreply@example.com'
7
7
  @cookie_expiration = lambda { 1.year.from_now.utc }
8
8
  end
9
+
10
+ def user_model
11
+ @user_model || ::User
12
+ end
9
13
  end
10
14
 
11
15
  class << self
@@ -25,6 +29,7 @@ module Clearance
25
29
  # config.mailer_sender = 'me@example.com'
26
30
  # config.cookie_expiration = lambda { 2.weeks.from_now.utc }
27
31
  # config.password_strategy = MyPasswordStrategy
32
+ # config.user_model = MyNamespace::MyUser
28
33
  # end
29
34
  def self.configure
30
35
  self.configuration ||= Configuration.new
@@ -12,7 +12,7 @@ module Clearance
12
12
 
13
13
  def current_user
14
14
  @current_user ||= with_remember_token do |token|
15
- ::User.find_by_remember_token(token)
15
+ Clearance.configuration.user_model.find_by_remember_token(token)
16
16
  end
17
17
  end
18
18
 
@@ -67,94 +67,92 @@ module Clearance
67
67
  end
68
68
  end
69
69
 
70
- module InstanceMethods
71
- # Set the remember token.
72
- #
73
- # @deprecated Use {#reset_remember_token!} instead
74
- def remember_me!
75
- warn "[DEPRECATION] remember_me!: use reset_remember_token! instead"
76
- reset_remember_token!
77
- end
70
+ # Set the remember token.
71
+ #
72
+ # @deprecated Use {#reset_remember_token!} instead
73
+ def remember_me!
74
+ warn "[DEPRECATION] remember_me!: use reset_remember_token! instead"
75
+ reset_remember_token!
76
+ end
78
77
 
79
- # Reset the remember token.
80
- #
81
- # @example
82
- # user.reset_remember_token!
83
- def reset_remember_token!
84
- generate_remember_token
85
- save(:validate => false)
86
- end
78
+ # Reset the remember token.
79
+ #
80
+ # @example
81
+ # user.reset_remember_token!
82
+ def reset_remember_token!
83
+ generate_remember_token
84
+ save(:validate => false)
85
+ end
87
86
 
88
- # Mark my account as forgotten password.
89
- #
90
- # @example
91
- # user.forgot_password!
92
- def forgot_password!
93
- generate_confirmation_token
94
- save(:validate => false)
95
- end
87
+ # Mark my account as forgotten password.
88
+ #
89
+ # @example
90
+ # user.forgot_password!
91
+ def forgot_password!
92
+ generate_confirmation_token
93
+ save(:validate => false)
94
+ end
96
95
 
97
- # Update my password.
98
- #
99
- # @return [true, false] password was updated or not
100
- # @example
101
- # user.update_password('new-password')
102
- def update_password(new_password)
103
- self.password_changing = true
104
- self.password = new_password
105
- if valid?
106
- self.confirmation_token = nil
107
- generate_remember_token
108
- end
109
- save
96
+ # Update my password.
97
+ #
98
+ # @return [true, false] password was updated or not
99
+ # @example
100
+ # user.update_password('new-password')
101
+ def update_password(new_password)
102
+ self.password_changing = true
103
+ self.password = new_password
104
+ if valid?
105
+ self.confirmation_token = nil
106
+ generate_remember_token
110
107
  end
108
+ save
109
+ end
111
110
 
112
- def password=(unencrypted_password)
113
- @password = unencrypted_password
114
- encrypt_password
115
- end
111
+ def password=(unencrypted_password)
112
+ @password = unencrypted_password
113
+ encrypt_password
114
+ end
116
115
 
117
- protected
116
+ protected
118
117
 
119
- def generate_random_code(length = 20)
120
- if RUBY_VERSION >= '1.9'
121
- SecureRandom.hex(length).encode('UTF-8')
122
- else
123
- SecureRandom.hex(length)
124
- end
118
+ def generate_random_code(length = 20)
119
+ if RUBY_VERSION >= '1.9'
120
+ SecureRandom.hex(length).encode('UTF-8')
121
+ else
122
+ SecureRandom.hex(length)
125
123
  end
124
+ end
126
125
 
127
- def generate_remember_token
128
- self.remember_token = generate_random_code
129
- end
126
+ def generate_remember_token
127
+ self.remember_token = generate_random_code
128
+ end
130
129
 
131
- def generate_confirmation_token
132
- self.confirmation_token = generate_random_code
133
- end
130
+ def generate_confirmation_token
131
+ self.confirmation_token = generate_random_code
132
+ end
134
133
 
135
- # Always false. Override to allow other forms of authentication
136
- # (username, facebook, etc).
137
- # @return [Boolean] true if the email field be left blank for this user
138
- def email_optional?
139
- false
140
- end
134
+ # Always false. Override to allow other forms of authentication
135
+ # (username, facebook, etc).
136
+ # @return [Boolean] true if the email field be left blank for this user
137
+ def email_optional?
138
+ false
139
+ end
141
140
 
142
- # True if the password has been set and the password is not being
143
- # updated and we are not updating the password. Override to allow
144
- # other forms of authentication (username, facebook, etc).
145
- # @return [Boolean] true if the password field can be left blank for this user
146
- def password_optional?
147
- encrypted_password.present? && password.blank? && password_changing.blank?
148
- end
141
+ # True if the password has been set and the password is not being
142
+ # updated and we are not updating the password. Override to allow
143
+ # other forms of authentication (username, facebook, etc).
144
+ # @return [Boolean] true if the password field can be left blank for this user
145
+ def password_optional?
146
+ encrypted_password.present? && password.blank? && password_changing.blank?
147
+ end
149
148
 
150
- def password_required?
151
- # warn "[DEPRECATION] password_required?: use !password_optional? instead"
152
- !password_optional?
153
- end
149
+ def password_required?
150
+ # warn "[DEPRECATION] password_required?: use !password_optional? instead"
151
+ !password_optional?
152
+ end
154
153
 
155
- def downcase_email
156
- self.email = email.to_s.downcase
157
- end
154
+ def downcase_email
155
+ self.email = email.to_s.downcase
158
156
  end
159
157
  end
160
158
  end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe Clearance::Configuration do
4
+ describe "when no user_model_name is specified" do
5
+ before do
6
+ Clearance.configure do |config|
7
+ end
8
+ end
9
+
10
+ it "defaults to User" do
11
+ Clearance.configuration.user_model.should == ::User
12
+ end
13
+ end
14
+
15
+ describe "when a custom user_model_name is specified" do
16
+ before do
17
+ MyUser = Class.new
18
+ Clearance.configure do |config|
19
+ config.user_model = MyUser
20
+ end
21
+ end
22
+
23
+ after do
24
+ Clearance.configure do |config|
25
+ config.user_model = ::User
26
+ end
27
+ end
28
+
29
+ it "is used instead of User" do
30
+ Clearance.configuration.user_model.should == ::MyUser
31
+ end
32
+ end
33
+ end
@@ -37,7 +37,7 @@ describe Clearance::PasswordsController do
37
37
  describe "with incorrect email address" do
38
38
  before do
39
39
  email = "user1@example.com"
40
- (::User.exists?(['email = ?', email])).should_not be
40
+ (Clearance.configuration.user_model.exists?(['email = ?', email])).should_not be
41
41
  ActionMailer::Base.deliveries.clear
42
42
  @user.reload.confirmation_token.should == @user.confirmation_token
43
43
 
@@ -33,17 +33,17 @@ describe User do
33
33
  end
34
34
 
35
35
  it "is authenticated with correct email and password" do
36
- (::User.authenticate(@user.email, @password)).should be
36
+ (Clearance.configuration.user_model.authenticate(@user.email, @password)).should be
37
37
  @user.should be_authenticated(@password)
38
38
  end
39
39
 
40
40
  it "is authenticated with correct uppercased email and correct password" do
41
- (::User.authenticate(@user.email.upcase, @password)).should be
41
+ (Clearance.configuration.user_model.authenticate(@user.email.upcase, @password)).should be
42
42
  @user.should be_authenticated(@password)
43
43
  end
44
44
 
45
45
  it "is authenticated with incorrect credentials" do
46
- (::User.authenticate(@user.email, 'bad_password')).should_not be
46
+ (Clearance.configuration.user_model.authenticate(@user.email, 'bad_password')).should_not be
47
47
  @user.should_not be_authenticated('bad password')
48
48
  end
49
49
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 14
8
+ - 15
9
9
  - 0
10
- version: 0.14.0
10
+ version: 0.15.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Croak
@@ -24,10 +24,11 @@ autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
26
 
27
- date: 2012-01-13 00:00:00 Z
27
+ date: 2012-02-03 00:00:00 Z
28
28
  dependencies:
29
29
  - !ruby/object:Gem::Dependency
30
- version_requirements: &id001 !ruby/object:Gem::Requirement
30
+ type: :runtime
31
+ requirement: &id001 !ruby/object:Gem::Requirement
31
32
  none: false
32
33
  requirements:
33
34
  - - ">="
@@ -37,12 +38,12 @@ dependencies:
37
38
  - 3
38
39
  - 0
39
40
  version: "3.0"
40
- requirement: *id001
41
- type: :runtime
42
41
  prerelease: false
43
42
  name: rails
43
+ version_requirements: *id001
44
44
  - !ruby/object:Gem::Dependency
45
- version_requirements: &id002 !ruby/object:Gem::Requirement
45
+ type: :runtime
46
+ requirement: &id002 !ruby/object:Gem::Requirement
46
47
  none: false
47
48
  requirements:
48
49
  - - ~>
@@ -53,12 +54,12 @@ dependencies:
53
54
  - 1
54
55
  - 5
55
56
  version: 0.1.5
56
- requirement: *id002
57
- type: :runtime
58
57
  prerelease: false
59
58
  name: diesel
59
+ version_requirements: *id002
60
60
  - !ruby/object:Gem::Dependency
61
- version_requirements: &id003 !ruby/object:Gem::Requirement
61
+ type: :development
62
+ requirement: &id003 !ruby/object:Gem::Requirement
62
63
  none: false
63
64
  requirements:
64
65
  - - ~>
@@ -69,12 +70,12 @@ dependencies:
69
70
  - 0
70
71
  - 0
71
72
  version: 1.0.0
72
- requirement: *id003
73
- type: :development
74
73
  prerelease: false
75
74
  name: bundler
75
+ version_requirements: *id003
76
76
  - !ruby/object:Gem::Dependency
77
- version_requirements: &id004 !ruby/object:Gem::Requirement
77
+ type: :development
78
+ requirement: &id004 !ruby/object:Gem::Requirement
78
79
  none: false
79
80
  requirements:
80
81
  - - ~>
@@ -85,28 +86,28 @@ dependencies:
85
86
  - 3
86
87
  - 8
87
88
  version: 0.3.8
88
- requirement: *id004
89
- type: :development
90
89
  prerelease: false
91
90
  name: appraisal
91
+ version_requirements: *id004
92
92
  - !ruby/object:Gem::Dependency
93
- version_requirements: &id005 !ruby/object:Gem::Requirement
93
+ type: :development
94
+ requirement: &id005 !ruby/object:Gem::Requirement
94
95
  none: false
95
96
  requirements:
96
97
  - - ~>
97
98
  - !ruby/object:Gem::Version
98
- hash: 19
99
+ hash: 17
99
100
  segments:
100
101
  - 1
101
- - 0
102
- - 2
103
- version: 1.0.2
104
- requirement: *id005
105
- type: :development
102
+ - 1
103
+ - 1
104
+ version: 1.1.1
106
105
  prerelease: false
107
106
  name: cucumber-rails
107
+ version_requirements: *id005
108
108
  - !ruby/object:Gem::Dependency
109
- version_requirements: &id006 !ruby/object:Gem::Requirement
109
+ type: :development
110
+ requirement: &id006 !ruby/object:Gem::Requirement
110
111
  none: false
111
112
  requirements:
112
113
  - - ~>
@@ -117,12 +118,12 @@ dependencies:
117
118
  - 6
118
119
  - 0
119
120
  version: 2.6.0
120
- requirement: *id006
121
- type: :development
122
121
  prerelease: false
123
122
  name: rspec-rails
123
+ version_requirements: *id006
124
124
  - !ruby/object:Gem::Dependency
125
- version_requirements: &id007 !ruby/object:Gem::Requirement
125
+ type: :development
126
+ requirement: &id007 !ruby/object:Gem::Requirement
126
127
  none: false
127
128
  requirements:
128
129
  - - ">="
@@ -131,12 +132,12 @@ dependencies:
131
132
  segments:
132
133
  - 0
133
134
  version: "0"
134
- requirement: *id007
135
- type: :development
136
135
  prerelease: false
137
136
  name: sqlite3
137
+ version_requirements: *id007
138
138
  - !ruby/object:Gem::Dependency
139
- version_requirements: &id008 !ruby/object:Gem::Requirement
139
+ type: :development
140
+ requirement: &id008 !ruby/object:Gem::Requirement
140
141
  none: false
141
142
  requirements:
142
143
  - - ">="
@@ -145,12 +146,12 @@ dependencies:
145
146
  segments:
146
147
  - 0
147
148
  version: "0"
148
- requirement: *id008
149
- type: :development
150
149
  prerelease: false
151
150
  name: bourne
151
+ version_requirements: *id008
152
152
  - !ruby/object:Gem::Dependency
153
- version_requirements: &id009 !ruby/object:Gem::Requirement
153
+ type: :development
154
+ requirement: &id009 !ruby/object:Gem::Requirement
154
155
  none: false
155
156
  requirements:
156
157
  - - ">="
@@ -159,10 +160,9 @@ dependencies:
159
160
  segments:
160
161
  - 0
161
162
  version: "0"
162
- requirement: *id009
163
- type: :development
164
163
  prerelease: false
165
164
  name: timecop
165
+ version_requirements: *id009
166
166
  description: Rails authentication & authorization with email & password.
167
167
  email: support@thoughtbot.com
168
168
  executables: []
@@ -178,9 +178,11 @@ files:
178
178
  - Appraisals
179
179
  - CHANGELOG.md
180
180
  - CONTRIBUTING.md
181
+ - ChangeLog
181
182
  - Gemfile
182
183
  - Gemfile.lock
183
184
  - LICENSE
185
+ - NEWS
184
186
  - README.md
185
187
  - Rakefile
186
188
  - VERSION
@@ -239,6 +241,7 @@ files:
239
241
  - lib/generators/clearance/views/views_generator.rb
240
242
  - spec/clearance/rack_session_spec.rb
241
243
  - spec/clearance/session_spec.rb
244
+ - spec/configuration_spec.rb
242
245
  - spec/controllers/denies_controller_spec.rb
243
246
  - spec/controllers/flashes_controller_spec.rb
244
247
  - spec/controllers/forgeries_controller_spec.rb
@@ -286,14 +289,5 @@ rubygems_version: 1.8.11
286
289
  signing_key:
287
290
  specification_version: 3
288
291
  summary: Rails authentication & authorization with email & password.
289
- test_files:
290
- - features/engine/visitor_resets_password.feature
291
- - features/engine/visitor_signs_in.feature
292
- - features/engine/visitor_signs_out.feature
293
- - features/engine/visitor_signs_up.feature
294
- - features/integration.feature
295
- - features/step_definitions/configuration_steps.rb
296
- - features/step_definitions/engine/clearance_steps.rb
297
- - features/support/aruba.rb
298
- - features/support/clearance.rb
299
- - features/support/env.rb
292
+ test_files: []
293
+