thoughtbot-clearance 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -92,27 +92,47 @@ In app/controllers/application_controller.rb:
92
92
  include Clearance::ApplicationController
93
93
  end
94
94
 
95
- h2. Views
96
-
97
- In app/views/sessions/new.html.erb
98
-
99
- <% form_for :session, :url => session_path do |f| %>
100
- <div class="group">
101
- <%= f.label :email %>
102
- <%= f.text_field :email %>
103
- </div>
104
- <div class="group">
105
- <%= f.label :password %>
106
- <%= f.password_field :password %>
107
- </div>
108
- <div class="checkbox">
109
- <%= f.check_box :remember_me %>
110
- <%= f.label :remember_me %>
111
- </div>
112
- <div class="group buttons">
113
- <%= f.submit 'Login', :disable_with => 'Please wait...' %>
114
- </div>
115
- <% end %>
95
+ h2. Migration
96
+
97
+ Your users table needs a few columns.
98
+
99
+ create_table(:users) do |t|
100
+ t.string :email
101
+ t.string :crypted_password, :limit => 40
102
+ t.string :salt, :limit => 40
103
+ t.string :remember_token
104
+ t.datetime :remember_token_expires_at
105
+ t.boolean :confirmed, :default => false, :null => false
106
+ end
107
+
108
+ add_index :users, [:email, :crypted_password]
109
+
110
+ h2. Routes
111
+
112
+ ActionController::Routing::Routes.draw do |map|
113
+
114
+ map.resources :users
115
+ map.resource :session
116
+
117
+ map.resources :users, :has_one => :password
118
+ map.resources :users, :has_one => :confirmation
119
+
120
+ map.resources :passwords
121
+
122
+ map.root :controller => 'sessions', :action => 'new'
123
+
124
+ map.with_options :controller => 'sessions' do |m|
125
+ m.login '/login', :action => 'new'
126
+ m.logout '/logout', :action => 'destroy'
127
+ end
128
+
129
+ end
130
+
131
+ h2. Environments
132
+
133
+ In config/environments/test.rb and config/environments/development.rb:
134
+
135
+ HOST = "localhost"
116
136
 
117
137
  h2. Authors
118
138
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'date'
4
- require 'activerecord'
5
4
  require 'lib/clearance/version'
6
5
 
7
6
  test_files_pattern = 'test/rails_root/test/{unit,functional,other}/**/*_test.rb'
data/TODO.textile CHANGED
@@ -1,11 +1,12 @@
1
1
  (this is in order of highest priority first)
2
2
 
3
- # Gemspec rake task
3
+ # force email confirmation by default
4
4
  # sessions controller test is missing some tests
5
5
  # mailers should not hardcode example.com as from address
6
6
  # check to make sure attr_accessible doesn't override and w/ attr_protected
7
7
  # helpers and tests shouldn't depend on login/logout routes
8
8
  # move shoulda macros in test_helper to shoulda_macros folder
9
+ # add shoulda and factory girl dependencies to gemspec
9
10
  # refactor Mailer default_url_options[:host] to something cleaner
10
11
 
11
12
  ideas stolen from merb-auth:
@@ -2,7 +2,7 @@ class ClearanceGenerator < Rails::Generator::Base
2
2
 
3
3
  def manifest
4
4
  record do |m|
5
- system `mkdir app/controllers`
5
+ m.directory File.join("app", "controllers")
6
6
  ["app/controllers/confirmations_controller.rb",
7
7
  "app/controllers/passwords_controller.rb",
8
8
  "app/controllers/sessions_controller.rb",
@@ -10,43 +10,43 @@ class ClearanceGenerator < Rails::Generator::Base
10
10
  m.file file, file
11
11
  end
12
12
 
13
- system `mkdir app/models`
13
+ m.directory File.join("app", "models")
14
14
  ["app/models/user.rb",
15
15
  "app/models/user_mailer.rb"].each do |file|
16
16
  m.file file, file
17
17
  end
18
18
 
19
- system `mkdir app/views`
19
+ m.directory File.join("app", "views")
20
20
  system `mkdir app/views/confirmations`
21
21
  ["app/views/confirmations/new.html.erb"].each do |file|
22
22
  m.file file, file
23
23
  end
24
24
 
25
- system `mkdir app/views/passwords`
25
+ m.directory File.join("app", "views", "passwords")
26
26
  ["app/views/passwords/new.html.erb",
27
27
  "app/views/passwords/edit.html.erb"].each do |file|
28
28
  m.file file, file
29
29
  end
30
30
 
31
- system `mkdir app/views/sessions`
31
+ m.directory File.join("app", "views", "sessions")
32
32
  ["app/views/sessions/new.html.erb"].each do |file|
33
33
  m.file file, file
34
34
  end
35
35
 
36
- system `mkdir app/views/user_mailer`
36
+ m.directory File.join("app", "views", "user_mailer")
37
37
  ["app/views/user_mailer/change_password.html.erb",
38
38
  "app/views/user_mailer/confirmation.html.erb"].each do |file|
39
39
  m.file file, file
40
40
  end
41
41
 
42
- system `mkdir app/views/users`
42
+ m.directory File.join("app", "views", "users")
43
43
  ["app/views/users/_form.html.erb",
44
44
  "app/views/users/edit.html.erb",
45
45
  "app/views/users/new.html.erb"].each do |file|
46
46
  m.file file, file
47
47
  end
48
48
 
49
- system `mkdir test/functional`
49
+ m.directory File.join("test", "functional")
50
50
  ["test/functional/confirmations_controller_test.rb",
51
51
  "test/functional/passwords_controller_test.rb",
52
52
  "test/functional/sessions_controller_test.rb",
@@ -54,11 +54,15 @@ class ClearanceGenerator < Rails::Generator::Base
54
54
  m.file file, file
55
55
  end
56
56
 
57
- system `mkdir test/unit`
57
+ m.directory File.join("test", "unit")
58
58
  ["test/unit/user_mailer_test.rb",
59
59
  "test/unit/user_test.rb"].each do |file|
60
60
  m.file file, file
61
61
  end
62
+
63
+ ["test/factories.rb"].each do |file|
64
+ m.file file, file
65
+ end
62
66
  end
63
67
  end
64
68
 
@@ -0,0 +1,9 @@
1
+ Factory.sequence :email do |n|
2
+ "user#{n}@example.com"
3
+ end
4
+
5
+ Factory.define :user do |user|
6
+ user.email { Factory.next :email }
7
+ user.password "password"
8
+ user.password_confirmation "password"
9
+ end
@@ -2,6 +2,6 @@ module Clearance
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 2
5
+ PATCH = 3
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoughtbot-clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot, inc.
@@ -58,6 +58,7 @@ files:
58
58
  - generators/clearance/templates/app/views/users/edit.html.erb
59
59
  - generators/clearance/templates/app/views/users/new.html.erb
60
60
  - generators/clearance/templates/test
61
+ - generators/clearance/templates/test/factories.rb
61
62
  - generators/clearance/templates/test/functional
62
63
  - generators/clearance/templates/test/functional/confirmations_controller_test.rb
63
64
  - generators/clearance/templates/test/functional/passwords_controller_test.rb