diff --git a/Gemfile b/Gemfile index 23c8ee51..59bc602a 100644 --- a/Gemfile +++ b/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 \ No newline at end of file diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index ad7c6fef..9195d1d0 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -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 diff --git a/test/orm/mongo_mapper.rb b/test/orm/mongo_mapper.rb index 12eb6997..e206c347 100644 --- a/test/orm/mongo_mapper.rb +++ b/test/orm/mongo_mapper.rb @@ -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 diff --git a/test/rails_app/app/mongo_mapper/admin.rb b/test/rails_app/app/mongo_mapper/admin.rb index 4c55c607..eb9a4e6c 100644 --- a/test/rails_app/app/mongo_mapper/admin.rb +++ b/test/rails_app/app/mongo_mapper/admin.rb @@ -1,5 +1,6 @@ class Admin include MongoMapper::Document + include MongoMapper::Plugins::Callbacks devise :authenticatable, :timeoutable diff --git a/test/rails_app/app/mongo_mapper/user.rb b/test/rails_app/app/mongo_mapper/user.rb index e80b5552..2a08aeb4 100644 --- a/test/rails_app/app/mongo_mapper/user.rb +++ b/test/rails_app/app/mongo_mapper/user.rb @@ -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 diff --git a/test/rails_app/config/application.rb b/test/rails_app/config/application.rb index 82cbc3d7..f3957c36 100644 --- a/test/rails_app/config/application.rb +++ b/test/rails_app/config/application.rb @@ -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| diff --git a/test/test_helper.rb b/test/test_helper.rb index 5f2b4c46..992224f1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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