Sha256: 8face941c03418ba9acfbe7d5eb8f3510788bd0e5a678cc2f8a3dcf2a8882daa

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require 'test/test_helper'

module Devise
  def self.clean_warden_config!
    @warden_config = nil 
  end
end

class DeviseTest < ActiveSupport::TestCase
  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
    config = Warden::Config.new
    Devise.configure_warden(config)

    assert_equal Devise::FailureApp, config.failure_app
    assert_equal [:authenticatable], config.default_strategies
    assert_equal :user, config.default_scope
    assert config.silence_missing_strategies?
    assert config.silence_missing_serializers?
  end

  test 'warden manager user configuration through a block' do
    begin
      @executed = false
      Devise.warden do |config|
        @executed = true
        assert_kind_of Warden::Config, config
      end

      Devise.configure_warden(Warden::Config.new)
      assert @executed
    ensure
      Devise.clean_warden_config!
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise-0.8.2 test/devise_test.rb
devise-0.8.1 test/devise_test.rb
devise-0.8.0 test/devise_test.rb