Get all tests passing for ActiveRecord and allow MongoMapper tests to run.
This commit is contained in:
parent
33941d1f62
commit
b4bbd3b892
6
Gemfile
6
Gemfile
|
@ -9,4 +9,10 @@ gem "bcrypt-ruby", :require => "bcrypt"
|
|||
|
||||
if RUBY_VERSION < '1.9'
|
||||
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
|
|
@ -250,13 +250,13 @@ class AuthenticationTest < ActionController::IntegrationTest
|
|||
end
|
||||
|
||||
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_not_contain 'Send me reset password instructions'
|
||||
end
|
||||
|
||||
test 'render 404 on roles without mapping' do
|
||||
get '/sign_in'
|
||||
get '/sign_in', {}, "action_dispatch.show_exceptions" => true
|
||||
assert_response :not_found
|
||||
assert_not_contain 'Sign in'
|
||||
end
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
require 'mongo_mapper'
|
||||
MongoMapper.database = "devise-test-suite"
|
||||
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
|
||||
|
||||
require File.expand_path('../../rails_app/config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
module MongoMapper::Document
|
||||
# TODO This should not be required
|
||||
def invalid?
|
||||
!valid?
|
||||
end
|
||||
end
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
setup do
|
||||
User.delete_all
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class Admin
|
||||
include MongoMapper::Document
|
||||
include MongoMapper::Plugins::Callbacks
|
||||
|
||||
devise :authenticatable, :timeoutable
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
class User
|
||||
include MongoMapper::Document
|
||||
|
||||
key :created_at, DateTime
|
||||
|
||||
devise :authenticatable, :http_authenticatable, :confirmable, :recoverable,
|
||||
:rememberable, :trackable, :validatable, :timeoutable, :lockable,
|
||||
:token_authenticatable
|
||||
|
||||
# attr_accessible :username, :email, :password, :password_confirmation
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ require "action_mailer/railtie"
|
|||
require "active_resource/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
|
||||
Bundler.require
|
||||
Bundler.require :default, DEVISE_ORM
|
||||
require "devise"
|
||||
|
||||
module RailsApp
|
||||
|
@ -16,7 +16,8 @@ module RailsApp
|
|||
config.root = File.expand_path("../..", __FILE__)
|
||||
|
||||
# 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.
|
||||
# config.generators do |g|
|
||||
|
|
|
@ -2,9 +2,11 @@ ENV["RAILS_ENV"] = "test"
|
|||
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
||||
|
||||
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 "mocha"
|
||||
require 'mocha'
|
||||
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
ActionMailer::Base.perform_deliveries = true
|
||||
|
|
Loading…
Reference in New Issue