clearance 0.8.5 → 0.8.6

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.textile CHANGED
@@ -1,9 +1,15 @@
1
+ h2. 0.8.6 (unreleased)
2
+
3
+ * Clearance features capitalization should match view text (Bobby Wilson)
4
+ * skip :authenticate before_filter in controllers so apps can easily
5
+ authenticate a whole site without subclassing (Matthew Ford)
6
+
1
7
  h2. 0.8.5 (01/20/2009)
2
8
 
3
9
  * replaced routing hack with Clearance::Routes.draw(map) to give
4
10
  more control to the application developer. (Dan Croak)
5
11
  * removed attr_accessible from Clearance::User. (Dan Croak)
6
- * fixed bug in password reset feature. (Dan Croak)
12
+ * fixed bug in password reset feature. (Ben Orenstein, Dan Croak)
7
13
  * use Jeweler for gemming. (Dan Croak)
8
14
  * remove dependency on root_path, use '/' instead. (Dan Croak)
9
15
  * use Clearance.configure block to set mailer sender instead of
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ Clearance
2
+ =========
3
+
4
+ Rails authentication with email & password.
5
+
6
+ [We have clearance, Clarence.](http://www.youtube.com/v/mNRXJEE3Nz8)
7
+
8
+ Help
9
+ ----
10
+
11
+ * [documentation](http://rdoc.info/projects/thoughtbot/clearance)
12
+ * [#thoughtbot](irc://irc.freenode.net/thoughtbot) IRC channel on freenode
13
+ * [mailing list](http://groups.google.com/group/thoughtbot-clearance)
14
+
15
+ Bugs, Patches
16
+ -------------
17
+
18
+ Fork away and create a [Github Issue](http://github.com/thoughtbot/clearance/issues).
19
+
20
+ Installation
21
+ ------------
22
+
23
+ Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
24
+
25
+ Install it as a gem however you like to install gems. Gem Bundler example:
26
+
27
+ gem "clearance"
28
+
29
+ Make sure the development database exists and run the generator:
30
+
31
+ script/generate clearance
32
+
33
+ This:
34
+
35
+ * inserts Clearance::User into your User model
36
+ * inserts Clearance::Authentication into your ApplicationController
37
+ * inserts Clearance::Routes.draw(map) into your config.routes.rb
38
+ * created a migration that either creates a users table or adds only missing columns
39
+ * prints further instructions
40
+
41
+ Usage
42
+ -----
43
+
44
+ If you want to authenticate users for a controller action, use the authenticate
45
+ method in a before_filter.
46
+
47
+ class WidgetsController < ApplicationController
48
+ before_filter :authenticate
49
+ def index
50
+ @widgets = Widget.all
51
+ end
52
+ end
53
+
54
+ Customizing
55
+ -----------
56
+
57
+ To change any of provided actions, subclass a Clearance controller...
58
+
59
+ class SessionsController < Clearance::SessionsController
60
+ def new
61
+ # my special new action
62
+ end
63
+ def url_after_create
64
+ my_special_path
65
+ end
66
+ end
67
+
68
+ and add your route above (before) Clearance routes in config/routes.rb:
69
+
70
+ map.resource :session, :controller => 'clearance/sessions'
71
+
72
+ See lib/clearance/routes.rb for all the routes Clearance provides.
73
+
74
+ Actions that redirect (create, update, and destroy) in Clearance controllers
75
+ can be overriden by re-defining url_after_(action) methods as seen above.
76
+
77
+ Optional Cucumber features
78
+ --------------------------
79
+
80
+ As your app evolves, you want to know that authentication still works. Our
81
+ opinion is that you should test its integration with your app using
82
+ [Cucumber](http://cukes.info).
83
+
84
+ Run the Cucumber generator and Clearance feature generator:
85
+
86
+ script/generate cucumber
87
+ script/generate clearance_features
88
+
89
+ All of the files generated should be new with the exception of the
90
+ features/support/paths.rb file. If you have not modified your paths.rb then you
91
+ will be okay to replace it with this one. If you need to keep your paths.rb
92
+ file then add these locations in your paths.rb manually:
93
+
94
+ def path_to(page_name)
95
+ case page_name
96
+ when /the sign up page/i
97
+ new_user_path
98
+ when /the sign in page/i
99
+ new_session_path
100
+ when /the password reset request page/i
101
+ new_password_path
102
+ end
103
+ end
104
+
105
+ Optional Formtastic views
106
+ -------------------------
107
+
108
+ We use & recommend [Formtastic](http://github.com/justinfrench/formtastic].
109
+
110
+ Clearance has another generator to generate Formastic views:
111
+
112
+ script/generate clearance_views
113
+
114
+ Its implementation is designed so other view styles (Haml?) can be generated.
115
+
116
+ Authors
117
+ -------
118
+
119
+ Clearance was extracted out of [Hoptoad](http://hoptoadapp.com). We merged the
120
+ authentication code from two of thoughtbot client Rails apps and have since
121
+ used it each time we need authentication.
122
+
123
+ The following people have improved the library. Thank you!
124
+
125
+ Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov,
126
+ Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey,
127
+ Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton,
128
+ Mustafa Ekim, Jon Yurek, Anuj Dutta, Chad Pytel, Ben Orenstein, Bobby Wilson,
129
+ and Matthew Ford.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.5
1
+ 0.8.6
@@ -1,6 +1,7 @@
1
1
  class Clearance::ConfirmationsController < ApplicationController
2
2
  unloadable
3
3
 
4
+ skip_before_filter :authenticate, :only => [:new, :create]
4
5
  before_filter :redirect_signed_in_confirmed_user, :only => [:new, :create]
5
6
  before_filter :redirect_signed_out_confirmed_user, :only => [:new, :create]
6
7
  before_filter :forbid_missing_token, :only => [:new, :create]
@@ -1,6 +1,7 @@
1
1
  class Clearance::PasswordsController < ApplicationController
2
2
  unloadable
3
3
 
4
+ skip_before_filter :authenticate, :only => [:edit, :update]
4
5
  before_filter :forbid_missing_token, :only => [:edit, :update]
5
6
  before_filter :forbid_non_existent_user, :only => [:edit, :update]
6
7
  filter_parameter_logging :password, :password_confirmation
@@ -1,6 +1,7 @@
1
1
  class Clearance::SessionsController < ApplicationController
2
2
  unloadable
3
3
 
4
+ skip_before_filter :authenticate, :only => [:new, :create, :destroy]
4
5
  protect_from_forgery :except => :create
5
6
  filter_parameter_logging :password
6
7
 
@@ -1,7 +1,8 @@
1
1
  class Clearance::UsersController < ApplicationController
2
2
  unloadable
3
3
 
4
- before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
4
+ skip_before_filter :authenticate, :only => [:new, :create]
5
+ before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in?
5
6
  filter_parameter_logging :password
6
7
 
7
8
  def new
@@ -25,9 +25,9 @@ class ClearanceGenerator < Rails::Generator::Base
25
25
  m.directory File.join("test", "factories")
26
26
  m.file "factories.rb", "test/factories/clearance.rb"
27
27
 
28
- m.migration_template "migrations/#{migration_name}.rb",
28
+ m.migration_template "migrations/#{migration_source_name}.rb",
29
29
  'db/migrate',
30
- :migration_file_name => "clearance_#{migration_name}"
30
+ :migration_file_name => "clearance_#{migration_target_name}"
31
31
 
32
32
  m.readme "README"
33
33
  end
@@ -35,7 +35,7 @@ class ClearanceGenerator < Rails::Generator::Base
35
35
 
36
36
  private
37
37
 
38
- def migration_name
38
+ def migration_source_name
39
39
  if ActiveRecord::Base.connection.table_exists?(:users)
40
40
  'update_users'
41
41
  else
@@ -43,4 +43,16 @@ class ClearanceGenerator < Rails::Generator::Base
43
43
  end
44
44
  end
45
45
 
46
+ def migration_target_name
47
+ if ActiveRecord::Base.connection.table_exists?(:users)
48
+ "update_users_to_#{schema_version}"
49
+ else
50
+ 'create_users'
51
+ end
52
+ end
53
+
54
+ def schema_version
55
+ IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).strip.gsub(/[^\d]/, '_')
56
+ end
57
+
46
58
  end
@@ -6,7 +6,6 @@ class ClearanceFeaturesGenerator < Rails::Generator::Base
6
6
  m.directory File.join("features", "support")
7
7
 
8
8
  ["features/step_definitions/clearance_steps.rb",
9
- "features/step_definitions/factory_girl_steps.rb",
10
9
  "features/support/paths.rb",
11
10
  "features/sign_in.feature",
12
11
  "features/sign_out.feature",
@@ -8,7 +8,7 @@ Feature: Sign up
8
8
  And I fill in "Email" with "invalidemail"
9
9
  And I fill in "Password" with "password"
10
10
  And I fill in "Confirm password" with ""
11
- And I press "Sign Up"
11
+ And I press "Sign up"
12
12
  Then I should see error messages
13
13
 
14
14
  Scenario: User signs up with valid data
@@ -16,7 +16,7 @@ Feature: Sign up
16
16
  And I fill in "Email" with "email@person.com"
17
17
  And I fill in "Password" with "password"
18
18
  And I fill in "Confirm password" with "password"
19
- And I press "Sign Up"
19
+ And I press "Sign up"
20
20
  Then I should see "instructions for confirming"
21
21
  And a confirmation message should be sent to "email@person.com"
22
22
 
@@ -97,7 +97,7 @@ When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
97
97
  When %{I go to the sign in page}
98
98
  And %{I fill in "Email" with "#{email}"}
99
99
  And %{I fill in "Password" with "#{password}"}
100
- And %{I press "Sign In"}
100
+ And %{I press "Sign in"}
101
101
  end
102
102
 
103
103
  When /^I sign out$/ do
@@ -62,7 +62,6 @@ module Clearance
62
62
  # sign_in(@user)
63
63
  def sign_in(user)
64
64
  if user
65
- user.remember_me!
66
65
  cookies[:remember_token] = {
67
66
  :value => user.remember_token,
68
67
  :expires => 1.year.from_now.utc
@@ -77,6 +76,7 @@ module Clearance
77
76
  # sign_out
78
77
  def sign_out
79
78
  cookies.delete(:remember_token)
79
+ current_user.reset_remember_token! if current_user
80
80
  current_user = nil
81
81
  end
82
82
 
@@ -49,12 +49,12 @@ module Clearance
49
49
  # :password must be present, confirmed
50
50
  def self.included(model)
51
51
  model.class_eval do
52
- validates_presence_of :email
53
- validates_uniqueness_of :email, :case_sensitive => false
54
- validates_format_of :email, :with => %r{.+@.+\..+}
52
+ validates_presence_of :email, :unless => :email_optional?
53
+ validates_uniqueness_of :email, :case_sensitive => false, :allow_blank => true
54
+ validates_format_of :email, :with => %r{.+@.+\..+}, :allow_blank => true
55
55
 
56
- validates_presence_of :password, :if => :password_required?
57
- validates_confirmation_of :password, :if => :password_required?
56
+ validates_presence_of :password, :unless => :password_optional?
57
+ validates_confirmation_of :password, :unless => :password_optional?
58
58
  end
59
59
  end
60
60
  end
@@ -66,9 +66,9 @@ module Clearance
66
66
  def self.included(model)
67
67
  model.class_eval do
68
68
  before_save :initialize_salt,
69
- :encrypt_password,
70
- :initialize_confirmation_token
71
-
69
+ :encrypt_password
70
+ before_create :generate_confirmation_token,
71
+ :generate_remember_token
72
72
  after_create :send_confirmation_email, :unless => :email_confirmed?
73
73
  end
74
74
  end
@@ -87,14 +87,18 @@ module Clearance
87
87
 
88
88
  # Set the remember token.
89
89
  #
90
- # @example
91
- # user.remember_me!
92
- # cookies[:remember_token] = {
93
- # :value => user.remember_token,
94
- # :expires => 1.year.from_now.utc
95
- # }
90
+ # @deprecated Use {#reset_remember_token!} instead
96
91
  def remember_me!
97
- self.remember_token = encrypt("--#{Time.now.utc}--#{password}--#{id}--")
92
+ warn "[DEPRECATION] remember_me!: use reset_remember_token! instead"
93
+ reset_remember_token!
94
+ end
95
+
96
+ # Reset the remember token.
97
+ #
98
+ # @example
99
+ # user.reset_remember_token!
100
+ def reset_remember_token!
101
+ generate_remember_token
98
102
  save(false)
99
103
  end
100
104
 
@@ -140,7 +144,7 @@ module Clearance
140
144
 
141
145
  def initialize_salt
142
146
  if new_record?
143
- self.salt = generate_hash("--#{Time.now.utc}--#{password}--")
147
+ self.salt = generate_hash("--#{Time.now.utc}--#{password}--#{rand}--")
144
148
  end
145
149
  end
146
150
 
@@ -154,15 +158,31 @@ module Clearance
154
158
  end
155
159
 
156
160
  def generate_confirmation_token
157
- self.confirmation_token = encrypt("--#{Time.now.utc}--#{password}--")
161
+ self.confirmation_token = encrypt("--#{Time.now.utc}--#{password}--#{rand}--")
162
+ end
163
+
164
+ def generate_remember_token
165
+ self.remember_token = encrypt("--#{Time.now.utc}--#{encrypted_password}--#{id}--#{rand}--")
166
+ end
167
+
168
+ # Always false. Override to allow other forms of authentication
169
+ # (username, facebook, etc).
170
+ # @return [Boolean] true if the email field be left blank for this user
171
+ def email_optional?
172
+ false
158
173
  end
159
174
 
160
- def initialize_confirmation_token
161
- generate_confirmation_token if new_record?
175
+ # True if the password has been set and the password is not being
176
+ # updated. Override to allow other forms of # authentication (username,
177
+ # facebook, etc).
178
+ # @return [Boolean] true if the password field can be left blank for this user
179
+ def password_optional?
180
+ encrypted_password.present? && password.blank?
162
181
  end
163
182
 
164
183
  def password_required?
165
- encrypted_password.blank? || !password.blank?
184
+ # warn "[DEPRECATION] password_required?: use !password_optional? instead"
185
+ !password_optional?
166
186
  end
167
187
 
168
188
  def send_confirmation_email
@@ -35,6 +35,7 @@ class SessionsControllerTest < ActionController::TestCase
35
35
  context "on POST to #create with good credentials" do
36
36
  setup do
37
37
  @user = Factory(:email_confirmed_user)
38
+ @user.update_attribute(:remember_token, "old-token")
38
39
  post :create, :session => {
39
40
  :email => @user.email,
40
41
  :password => @user.password }
@@ -47,8 +48,8 @@ class SessionsControllerTest < ActionController::TestCase
47
48
  assert ! cookies['remember_token'].empty?
48
49
  end
49
50
 
50
- should 'set the token in users table' do
51
- assert_not_nil @user.reload.remember_token
51
+ should "not change the remember token" do
52
+ assert_equal "old-token", @user.reload.remember_token
52
53
  end
53
54
  end
54
55
 
@@ -121,6 +122,7 @@ class SessionsControllerTest < ActionController::TestCase
121
122
  context "on DELETE to #destroy with a cookie" do
122
123
  setup do
123
124
  @user = Factory(:email_confirmed_user)
125
+ @user.update_attribute(:remember_token, "old-token")
124
126
  cookies['remember_token'] = CGI::Cookie.new('token', 'value')
125
127
  sign_in_as @user
126
128
  delete :destroy
@@ -133,8 +135,8 @@ class SessionsControllerTest < ActionController::TestCase
133
135
  assert_nil cookies['remember_token']
134
136
  end
135
137
 
136
- should "delete the database token" do
137
- assert_nil @user.reload.remember_token
138
+ should "reset the remember token" do
139
+ assert_not_equal "old-token", @user.reload.remember_token
138
140
  end
139
141
  end
140
142
 
@@ -73,7 +73,7 @@ class UserTest < ActiveSupport::TestCase
73
73
  end
74
74
 
75
75
  context "When multiple users have signed up" do
76
- setup { @user = Factory(:user) }
76
+ setup { Factory(:user) }
77
77
  should_validate_uniqueness_of :email
78
78
  end
79
79
 
@@ -120,17 +120,17 @@ class UserTest < ActiveSupport::TestCase
120
120
  end
121
121
  end
122
122
 
123
- # remember me
123
+ # resetting remember token
124
124
 
125
- context "When authenticating with remember_me!" do
125
+ context "When resetting authentication with reset_remember_token!" do
126
126
  setup do
127
127
  @user = Factory(:email_confirmed_user)
128
- assert_nil @user.remember_token
129
- @user.remember_me!
128
+ @user.remember_token = "old-token"
129
+ @user.reset_remember_token!
130
130
  end
131
131
 
132
- should "set the remember token" do
133
- assert_not_nil @user.remember_token
132
+ should "change the remember token" do
133
+ assert_not_equal "old-token", @user.remember_token
134
134
  end
135
135
  end
136
136
 
@@ -155,6 +155,7 @@ class UserTest < ActiveSupport::TestCase
155
155
  end
156
156
 
157
157
  should "not generate the same remember token for users with the same password at the same time" do
158
+ Time.stubs(:now => Time.now)
158
159
  password = 'secret'
159
160
  first_user = Factory(:email_confirmed_user,
160
161
  :password => password,
@@ -163,10 +164,6 @@ class UserTest < ActiveSupport::TestCase
163
164
  :password => password,
164
165
  :password_confirmation => password)
165
166
 
166
- Time.stubs(:now => Time.now)
167
- first_user.remember_me!
168
- second_user.remember_me!
169
-
170
167
  assert_not_equal first_user.remember_token, second_user.remember_token
171
168
  end
172
169
 
@@ -224,4 +221,35 @@ class UserTest < ActiveSupport::TestCase
224
221
 
225
222
  end
226
223
 
224
+ # optional email/password fields
225
+ context "a user with an optional email" do
226
+ setup do
227
+ @user = User.new
228
+ class << @user
229
+ def email_optional?
230
+ true
231
+ end
232
+ end
233
+ end
234
+
235
+ subject { @user }
236
+
237
+ should_allow_values_for :email, nil, ""
238
+ end
239
+
240
+ context "a user with an optional password" do
241
+ setup do
242
+ @user = User.new
243
+ class << @user
244
+ def password_optional?
245
+ true
246
+ end
247
+ end
248
+ end
249
+
250
+ subject { @user }
251
+
252
+ should_allow_values_for :password, nil, ""
253
+ end
254
+
227
255
  end
@@ -97,7 +97,7 @@ When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
97
97
  When %{I go to the sign in page}
98
98
  And %{I fill in "Email" with "#{email}"}
99
99
  And %{I fill in "Password" with "#{password}"}
100
- And %{I press "Sign In"}
100
+ And %{I press "Sign in"}
101
101
  end
102
102
 
103
103
  When /^I sign out$/ do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -26,7 +26,7 @@ autorequire:
26
26
  bindir: bin
27
27
  cert_chain: []
28
28
 
29
- date: 2010-01-20 00:00:00 -05:00
29
+ date: 2010-02-17 00:00:00 -05:00
30
30
  default_executable:
31
31
  dependencies: []
32
32
 
@@ -38,11 +38,11 @@ extensions: []
38
38
 
39
39
  extra_rdoc_files:
40
40
  - LICENSE
41
- - README.textile
41
+ - README.md
42
42
  files:
43
43
  - CHANGELOG.textile
44
44
  - LICENSE
45
- - README.textile
45
+ - README.md
46
46
  - Rakefile
47
47
  - VERSION
48
48
  - app/controllers/clearance/confirmations_controller.rb
@@ -74,7 +74,6 @@ files:
74
74
  - generators/clearance_features/templates/features/sign_out.feature
75
75
  - generators/clearance_features/templates/features/sign_up.feature
76
76
  - generators/clearance_features/templates/features/step_definitions/clearance_steps.rb
77
- - generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb
78
77
  - generators/clearance_features/templates/features/support/paths.rb
79
78
  - generators/clearance_views/USAGE
80
79
  - generators/clearance_views/clearance_views_generator.rb
@@ -139,13 +138,12 @@ test_files:
139
138
  - test/rails_root/config/environments/production.rb
140
139
  - test/rails_root/config/environments/test.rb
141
140
  - test/rails_root/config/initializers/clearance.rb
142
- - test/rails_root/config/initializers/clearance_loader.rb
143
141
  - test/rails_root/config/initializers/inflections.rb
144
142
  - test/rails_root/config/initializers/mime_types.rb
145
143
  - test/rails_root/config/initializers/requires.rb
146
144
  - test/rails_root/config/initializers/time_formats.rb
147
145
  - test/rails_root/config/routes.rb
148
- - test/rails_root/db/migrate/20100120045223_clearance_create_users.rb
146
+ - test/rails_root/db/migrate/20100217171349_clearance_create_users.rb
149
147
  - test/rails_root/features/step_definitions/clearance_steps.rb
150
148
  - test/rails_root/features/step_definitions/factory_girl_steps.rb
151
149
  - test/rails_root/features/step_definitions/web_steps.rb
data/README.textile DELETED
@@ -1,108 +0,0 @@
1
- h1. Clearance
2
-
3
- Rails authentication with email & password.
4
-
5
- "We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8
6
-
7
- h2. Help
8
-
9
- * "#thoughtbot":irc://irc.freenode.net/thoughtbot IRC channel on freenode
10
- * "documentation":http://rdoc.info/projects/thoughtbot/clearance
11
- * "mailing list":http://groups.google.com/group/thoughtbot-clearance
12
-
13
- h2. Bugs, Patches
14
-
15
- Fork away and create a "Github Issue":http://github.com/thoughtbot/clearance/issues.
16
-
17
- h2. Installation
18
-
19
- Clearance is a Rails engine. It works with versions of Rails greater than 2.3.
20
-
21
- Install it as a gem however you like to install gems. Gem Bundler example:
22
-
23
- <pre>
24
- gem "clearance"
25
- </pre>
26
-
27
- Make sure the development database exists and run the generator:
28
-
29
- <pre>
30
- script/generate clearance
31
- </pre>
32
-
33
- This:
34
-
35
- * inserts Clearance::User into your User model
36
- * inserts Clearance::Authentication into your ApplicationController
37
- * inserts Clearance::Routes.draw(map) into your config.routes.rb
38
- * created a migration that either creates a users table or adds only missing columns
39
- * prints further instructions
40
-
41
- h2. Usage
42
-
43
- If you want to authenticate users for a controller action, use the authenticate method in a before_filter.
44
-
45
- class WidgetsController < ApplicationController
46
- before_filter :authenticate
47
-
48
- def index
49
- @widgets = Widget.all
50
- end
51
- end
52
-
53
- Subclass and override any Clearance-provided controller as needed:
54
-
55
- class SessionsController < Clearance::SessionsController
56
- def url_after_create
57
- new_blog_post_path
58
- end
59
- end
60
-
61
- Actions that redirect (create, update, and destroy) in Clearance controllers
62
- can be overriden by re-defining url_after_(action) methods as seen above.
63
-
64
- h2. Optional Cucumber features
65
-
66
- As your app evolves, you want to know that authentication still works. thoughtbot's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/.
67
-
68
- Run the Cucumber generator (if you haven't already) and Clearance's feature generator:
69
-
70
- <pre>
71
- script/generate cucumber
72
- script/generate clearance_features
73
- </pre>
74
-
75
- All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:
76
-
77
- <pre>
78
- def path_to(page_name)
79
- case page_name
80
- ...
81
- when /the sign up page/i
82
- new_user_path
83
- when /the sign in page/i
84
- new_session_path
85
- when /the password reset request page/i
86
- new_password_path
87
- ...
88
- end
89
- </pre>
90
-
91
- h2. Optional Formtastic views
92
-
93
- We have begun standardizing our forms using "Formtastic":http://github.com/justinfrench/formtastic. We highly recommend trying it. It will make your Rails view life more interesting.
94
-
95
- Clearance has another generator to generate Formastic views:
96
-
97
- <pre>
98
- script/generate clearance_views
99
- </pre>
100
-
101
- Its implementation is designed so that other view styles can be generated if the community wants it. However, we haven't needed them so you'll have to write the patch and send it back if you want other styles (such as Haml).
102
-
103
- h2. Authors
104
-
105
- Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's clients' Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you!
106
-
107
- Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton, Mustafa Ekim, Jon Yurek, Anuj Dutta, and Chad Pytel.
108
-
@@ -1,5 +0,0 @@
1
- Factory.factories.each do |name, factory|
2
- Given /^an? #{name} exists with an? (.*) of "([^"]*)"$/ do |attr, value|
3
- Factory(name, attr.gsub(' ', '_') => value)
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- # This simulates loading the clearance gem, but without relying on
2
- # vendor/gems
3
-
4
- clearance_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..))
5
- clearance_lib_path = File.join(clearance_path, "lib")
6
-
7
- $LOAD_PATH.unshift(clearance_lib_path)
8
- load File.join(clearance_path, 'rails', 'init.rb')