Skip to content
Browse files

Generating clearance user

  • Loading branch information...
1 parent 1f55b74 commit 7b3751122a8aaebbfbb7b999fa0f8943ca792a41 @qrush qrush committed May 27, 2009
View
4 Rakefile
@@ -7,8 +7,8 @@ require 'spec/rake/spectask'
require 'tasks/rails'
-desc 'Run the specs'
-task :default => [:spec]
+desc "Run all tests and features"
+task :default => [:test, :features]
desc "Clean out files that aren't needed."
task :clean do
View
1 app/controllers/application_controller.rb
@@ -2,6 +2,7 @@
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
+ include Clearance::Authentication
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
View
3 app/models/user.rb
@@ -0,0 +1,3 @@
+class User < ActiveRecord::Base
+ include Clearance::User
+end
View
2 config/environment.rb
@@ -12,3 +12,5 @@
:source => 'http://gems.github.com',
:version => '0.6.5'
end
+
+DO_NOT_REPLY = "donotreply@gemcutter.org"
View
4 config/environments/development.rb
@@ -14,4 +14,6 @@
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
+config.action_mailer.raise_delivery_errors = false
+
+HOST = "localhost"
View
4 config/environments/production.rb
@@ -25,4 +25,6 @@
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
-# config.threadsafe!
+# config.threadsafe!
+
+HOST = "gemcutter.org"
View
6 config/environments/test.rb
@@ -31,5 +31,11 @@
:lib => 'shoulda',
:source => 'http://gems.github.com',
:version => '>= 2.10.1'
+config.gem 'thoughtbot-factory_girl',
+ :lib => 'factory_girl',
+ :source => 'http://gems.github.com',
+ :version => '>= 1.2.1'
require 'redgreen'
+
+HOST = "localhost"
View
20 db/migrate/20090527120326_clearance_create_users.rb
@@ -0,0 +1,20 @@
+class ClearanceCreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table(:users) do |t|
+ t.string :email
+ t.string :encrypted_password, :limit => 128
+ t.string :salt, :limit => 128
+ t.string :token, :limit => 128
+ t.datetime :token_expires_at
+ t.boolean :email_confirmed, :default => false, :null => false
+ end
+
+ add_index :users, [:id, :token]
+ add_index :users, :email
+ add_index :users, :token
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
View
27 db/schema.rb
@@ -0,0 +1,27 @@
+# This file is auto-generated from the current state of the database. Instead of editing this file,
+# please use the migrations feature of Active Record to incrementally modify your database, and
+# then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your database schema. If you need
+# to create the application database on another system, you should be using db:schema:load, not running
+# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20090527120326) do
+
+ create_table "users", :force => true do |t|
+ t.string "email"
+ t.string "encrypted_password", :limit => 128
+ t.string "salt", :limit => 128
+ t.string "token", :limit => 128
+ t.datetime "token_expires_at"
+ t.boolean "email_confirmed", :default => false, :null => false
+ end
+
+ add_index "users", ["email"], :name => "index_users_on_email"
+ add_index "users", ["id", "token"], :name => "index_users_on_id_and_token"
+ add_index "users", ["token"], :name => "index_users_on_token"
+
+end
View
13 test/factories/clearance.rb
@@ -0,0 +1,13 @@
+Factory.sequence :email do |n|
+ "user#{n}@example.com"
+end
+
+Factory.define :user do |user|
+ user.email { Factory.next :email }
+ user.password { "password" }
+ user.password_confirmation { "password" }
+end
+
+Factory.define :email_confirmed_user, :parent => :user do |user|
+ user.email_confirmed { true }
+end

0 comments on commit 7b37511

Please sign in to comment.
Something went wrong with that request. Please try again.