Sha256: 57977afa7ee2b5aa36c7596349f33ae1cea63fd4b450e79a3c1ecea261c6c8a9

Contents?: true

Size: 1.61 KB

Versions: 10

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe Devise::TokenAuthenticatable do
  context "configuring the token_expires_in" do
    let(:expire_time) { 1.hour }

    it "should set the configuration" do
      expect {
        Devise::TokenAuthenticatable.setup do |config|
          config.token_expires_in = expire_time
        end
      }.to change { Devise::TokenAuthenticatable.token_expires_in }.from(nil).to(expire_time)
    end
  end

  context "configuring the token_authentication_key" do
    let(:new_key) { :other_key }

    it "should set the configuration" do
      expect {
        Devise::TokenAuthenticatable.setup do |config|
          config.token_authentication_key = new_key
        end
      }.to change { Devise::TokenAuthenticatable.token_authentication_key }.from(:auth_token).to(new_key)
    end
  end

  context "configuring the should_reset_authentication_token" do
    let(:should_reset) { true }

    it "should set the configuration" do
      expect {
        Devise::TokenAuthenticatable.setup do |config|
          config.should_reset_authentication_token = should_reset
        end
      }.to change { Devise::TokenAuthenticatable.should_reset_authentication_token }.from(false).to(should_reset)
    end
  end

  context "configuring the should_ensure_authentication_token" do
    let(:should_ensure) { true }

    it "should set the configuration" do
      expect {
        Devise::TokenAuthenticatable.setup do |config|
          config.should_ensure_authentication_token = should_ensure
        end
      }.to change { Devise::TokenAuthenticatable.should_ensure_authentication_token }.from(false).to(should_ensure)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
devise-token_authenticatable-1.1.0 spec/token_authenticatable_spec.rb
devise-token_authenticatable-1.0.2 spec/token_authenticatable_spec.rb
devise-token_authenticatable-1.0.1 spec/token_authenticatable_spec.rb
devise-token_authenticatable-1.0.0 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.5.3 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.5.2 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.5.1 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.4.10 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.5.0 spec/token_authenticatable_spec.rb
devise-token_authenticatable-0.4.9 spec/token_authenticatable_spec.rb