mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Get all tests passing for ActiveRecord and allow MongoMapper tests to run.
This commit is contained in:
parent
33941d1f62
commit
b4bbd3b892
7 changed files with 18 additions and 13 deletions
6
Gemfile
6
Gemfile
|
@ -9,4 +9,10 @@ gem "bcrypt-ruby", :require => "bcrypt"
|
||||||
|
|
||||||
if RUBY_VERSION < '1.9'
|
if RUBY_VERSION < '1.9'
|
||||||
gem "ruby-debug", ">= 0.10.3"
|
gem "ruby-debug", ">= 0.10.3"
|
||||||
|
end
|
||||||
|
|
||||||
|
group :mongo_mapper do
|
||||||
|
gem "mongo", "0.18.3"
|
||||||
|
gem "mongo_ext", "0.18.3", :require => false
|
||||||
|
gem "mongo_mapper", "0.7.0"
|
||||||
end
|
end
|
|
@ -250,13 +250,13 @@ class AuthenticationTest < ActionController::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'render 404 on roles without permission' do
|
test 'render 404 on roles without permission' do
|
||||||
get '/admin_area/password/new'
|
get '/admin_area/password/new', {}, "action_dispatch.show_exceptions" => true
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
assert_not_contain 'Send me reset password instructions'
|
assert_not_contain 'Send me reset password instructions'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'render 404 on roles without mapping' do
|
test 'render 404 on roles without mapping' do
|
||||||
get '/sign_in'
|
get '/sign_in', {}, "action_dispatch.show_exceptions" => true
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
assert_not_contain 'Sign in'
|
assert_not_contain 'Sign in'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
require 'mongo_mapper'
|
|
||||||
MongoMapper.database = "devise-test-suite"
|
MongoMapper.database = "devise-test-suite"
|
||||||
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
|
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
|
||||||
|
|
||||||
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
|
|
||||||
module MongoMapper::Document
|
|
||||||
# TODO This should not be required
|
|
||||||
def invalid?
|
|
||||||
!valid?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class ActiveSupport::TestCase
|
class ActiveSupport::TestCase
|
||||||
setup do
|
setup do
|
||||||
User.delete_all
|
User.delete_all
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class Admin
|
class Admin
|
||||||
include MongoMapper::Document
|
include MongoMapper::Document
|
||||||
|
include MongoMapper::Plugins::Callbacks
|
||||||
|
|
||||||
devise :authenticatable, :timeoutable
|
devise :authenticatable, :timeoutable
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
class User
|
class User
|
||||||
include MongoMapper::Document
|
include MongoMapper::Document
|
||||||
|
|
||||||
key :created_at, DateTime
|
key :created_at, DateTime
|
||||||
|
|
||||||
devise :authenticatable, :http_authenticatable, :confirmable, :recoverable,
|
devise :authenticatable, :http_authenticatable, :confirmable, :recoverable,
|
||||||
:rememberable, :trackable, :validatable, :timeoutable, :lockable,
|
:rememberable, :trackable, :validatable, :timeoutable, :lockable,
|
||||||
:token_authenticatable
|
:token_authenticatable
|
||||||
|
|
||||||
# attr_accessible :username, :email, :password, :password_confirmation
|
# attr_accessible :username, :email, :password, :password_confirmation
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ require "action_mailer/railtie"
|
||||||
require "active_resource/railtie"
|
require "active_resource/railtie"
|
||||||
require "rails/test_unit/railtie"
|
require "rails/test_unit/railtie"
|
||||||
|
|
||||||
Bundler.require
|
Bundler.require :default, DEVISE_ORM
|
||||||
require "devise"
|
require "devise"
|
||||||
|
|
||||||
module RailsApp
|
module RailsApp
|
||||||
|
@ -16,7 +16,8 @@ module RailsApp
|
||||||
config.root = File.expand_path("../..", __FILE__)
|
config.root = File.expand_path("../..", __FILE__)
|
||||||
|
|
||||||
# Add additional load paths for your own custom dirs
|
# Add additional load paths for your own custom dirs
|
||||||
config.load_paths += [ "#{config.root}/app/#{DEVISE_ORM}/" ]
|
config.load_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
|
||||||
|
config.load_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
|
||||||
|
|
||||||
# Configure generators values. Many other options are available, be sure to check the documentation.
|
# Configure generators values. Many other options are available, be sure to check the documentation.
|
||||||
# config.generators do |g|
|
# config.generators do |g|
|
||||||
|
|
|
@ -2,9 +2,11 @@ ENV["RAILS_ENV"] = "test"
|
||||||
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
||||||
|
|
||||||
puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
|
puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
|
||||||
|
|
||||||
|
require File.expand_path('../rails_app/config/application', __FILE__)
|
||||||
require File.expand_path("../orm/#{DEVISE_ORM}", __FILE__)
|
require File.expand_path("../orm/#{DEVISE_ORM}", __FILE__)
|
||||||
|
|
||||||
require "mocha"
|
require 'mocha'
|
||||||
|
|
||||||
ActionMailer::Base.delivery_method = :test
|
ActionMailer::Base.delivery_method = :test
|
||||||
ActionMailer::Base.perform_deliveries = true
|
ActionMailer::Base.perform_deliveries = true
|
||||||
|
|
Loading…
Reference in a new issue