Sha256: 7509cbb5370d230f649351ee92e42429eaffec938bc0f9bc03381110f1b47c77

Contents?: true

Size: 1.47 KB

Versions: 10

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'authenticate/configuration'

describe Authenticate::Configuration do
  context 'user model' do
    module Gug
      # Faux user model
      class Profile
        extend ActiveModel::Naming
      end
    end

    before(:each) do
      @conf = Authenticate::Configuration.new
      @conf.user_model = 'Gug::Profile'
    end

    it 'gets a class for a user model' do
      expect(@conf.user_model_class).to be(Gug::Profile)
    end

    it 'get a route key for a user model' do
      expect(@conf.user_model_route_key).to eq('gug_profiles')
    end

    it 'get a param key for a user model' do
      expect(@conf.user_model_param_key).to eq(:gug_profile)
    end

    describe '#authentication_strategy' do
      context 'with no strategy set' do
        it 'defaults to email' do
          expect(@conf.authentication_strategy).to eq :email
        end
        it 'includes email in modules' do
          expect(@conf.modules).to include :email
        end
        it 'does not include username in modules' do
          expect(@conf.modules).to_not include :username
        end
      end

      context 'with strategy set to username' do
        before do
          @conf.authentication_strategy = :username
        end
        it 'includes username in modules' do
          expect(@conf.modules).to include :username
        end
        it 'does not include email in modules' do
          expect(@conf.modules).to_not include :email
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authenticate-0.7.3 spec/model/configuration_spec.rb
authenticate-0.7.2 spec/model/configuration_spec.rb
authenticate-0.7.1 spec/model/configuration_spec.rb
authenticate-0.7.0 spec/model/configuration_spec.rb
authenticate-0.6.1 spec/model/configuration_spec.rb
authenticate-0.6.0 spec/model/configuration_spec.rb
authenticate-0.5.0 spec/model/configuration_spec.rb
authenticate-0.4.0 spec/model/configuration_spec.rb
authenticate-0.3.3 spec/model/configuration_spec.rb
authenticate-0.3.2 spec/model/configuration_spec.rb