Sha256: 5b4746ac59b749005d90c3f9fccd21ad1df08f1840acd5fd25d512c8a331a2f7
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
require 'test/test_helper' module Devise def self.clean_warden_config! @warden_config = nil end end class DeviseTest < ActiveSupport::TestCase class MockManager attr_accessor :failure_app attr_reader :default_strategies, :silence_missing_strategies def silence_missing_strategies! @silence_missing_strategies = true end def default_strategies(*args) if args.empty? @default_strategies else @default_strategies = args end end end test 'DeviseMailer.sender can be configured through Devise' do swap DeviseMailer, :sender => "foo@bar" do assert_equal "foo@bar", DeviseMailer.sender Devise.mail_sender = "bar@foo" assert_equal "bar@foo", DeviseMailer.sender end end test 'model options can be configured through Devise' do swap Devise, :confirm_within => 113, :pepper => "foo" do assert_equal 113, Devise.confirm_within assert_equal "foo", Devise.pepper end end test 'setup block yields self' do Devise.setup do |config| assert_equal Devise, config end end test 'warden manager configuration' do manager = MockManager.new Devise.configure_warden_manager(manager) assert_equal Devise::Failure, manager.failure_app assert_equal [:rememberable, :authenticatable], manager.default_strategies assert manager.silence_missing_strategies end test 'warden manager user configuration through a block' do begin @executed = false Devise.warden do |manager| @executed = true assert_kind_of MockManager, manager end manager = MockManager.new Devise.configure_warden_manager(manager) assert @executed ensure Devise.clean_warden_config! end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise-0.4.1 | test/devise_test.rb |
devise-0.4.0 | test/devise_test.rb |