mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Allow the dummy application in test/rails_app to boot.
This commit is contained in:
parent
42d06a241b
commit
dac7887d7c
8 changed files with 132 additions and 26 deletions
2
Gemfile
2
Gemfile
|
@ -19,7 +19,7 @@ group :mongoid do
|
|||
end
|
||||
|
||||
group :data_mapper do
|
||||
gem 'do_sqlite3', '>= 0.10.1'
|
||||
gem "do_sqlite3", '>= 0.10.1'
|
||||
gem "dm-core", :git => "git://github.com/datamapper/dm-core.git"
|
||||
gem "dm-validations", :git => "git://github.com/datamapper/dm-more.git"
|
||||
gem "dm-timestamps", :git => "git://github.com/datamapper/dm-more.git"
|
||||
|
|
|
@ -1,25 +1,7 @@
|
|||
ActiveRecord::Migration.verbose = false
|
||||
ActiveRecord::Base.logger = Logger.new(nil)
|
||||
|
||||
ActiveRecord::Schema.define(:version => 1) do
|
||||
[:users, :admins, :accounts].each do |table|
|
||||
create_table table do |t|
|
||||
t.authenticatable :null => table == :admins
|
||||
|
||||
if table != :admin
|
||||
t.string :username
|
||||
t.confirmable
|
||||
t.recoverable
|
||||
t.rememberable
|
||||
t.trackable
|
||||
t.lockable
|
||||
t.token_authenticatable
|
||||
end
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__))
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
self.use_transactional_fixtures = true
|
||||
|
|
4
test/rails_app/config.ru
Normal file
4
test/rails_app/config.ru
Normal file
|
@ -0,0 +1,4 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
run RailsApp::Application
|
|
@ -1,20 +1,21 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
|
||||
DEVISE_ORM = :active_record unless defined? DEVISE_ORM
|
||||
|
||||
require "active_record/railtie" if DEVISE_ORM == :active_record
|
||||
require "action_controller/railtie"
|
||||
require "action_mailer/railtie"
|
||||
require "active_resource/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
|
||||
Bundler.require :default, DEVISE_ORM
|
||||
|
||||
begin
|
||||
require "#{DEVISE_ORM}/railtie"
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
require "devise"
|
||||
|
||||
module RailsApp
|
||||
class Application < Rails::Application
|
||||
config.root = File.expand_path("../..", __FILE__)
|
||||
|
||||
# Add additional load paths for your own custom dirs
|
||||
config.load_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
|
||||
config.load_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
unless defined?(DEVISE_ORM)
|
||||
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
||||
end
|
||||
|
||||
begin
|
||||
require File.expand_path("../../../../.bundle/environment", __FILE__)
|
||||
rescue LoadError
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
||||
development:
|
||||
adapter: sqlite3
|
||||
database: ":memory:"
|
||||
database: db/development.sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
|
|
27
test/rails_app/db/migrate/20100401102949_create_tables.rb
Normal file
27
test/rails_app/db/migrate/20100401102949_create_tables.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
class CreateTables < ActiveRecord::Migration
|
||||
def self.up
|
||||
[:users, :admins, :accounts].each do |table|
|
||||
create_table table do |t|
|
||||
t.authenticatable :null => table == :admins
|
||||
|
||||
if table != :admin
|
||||
t.string :username
|
||||
t.confirmable
|
||||
t.recoverable
|
||||
t.rememberable
|
||||
t.trackable
|
||||
t.lockable
|
||||
t.token_authenticatable
|
||||
end
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
[:users, :admins, :accounts].each do |table|
|
||||
drop_table table
|
||||
end
|
||||
end
|
||||
end
|
86
test/rails_app/db/schema.rb
Normal file
86
test/rails_app/db/schema.rb
Normal file
|
@ -0,0 +1,86 @@
|
|||
# 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 => 20100401102949) do
|
||||
|
||||
create_table "accounts", :force => true do |t|
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "username"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "reset_password_token"
|
||||
t.string "remember_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", :default => 0
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "authentication_token"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "admins", :force => true do |t|
|
||||
t.string "email", :default => ""
|
||||
t.string "encrypted_password", :default => ""
|
||||
t.string "password_salt", :default => ""
|
||||
t.string "username"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "reset_password_token"
|
||||
t.string "remember_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", :default => 0
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "authentication_token"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "username"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "reset_password_token"
|
||||
t.string "remember_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", :default => 0
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "authentication_token"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Reference in a new issue