Sha256: 423e4171f9d53e8fef44a7de74af8f82693f5d6dfdb979b8e57a40655b6c4e71

Contents?: true

Size: 976 Bytes

Versions: 24

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

describe CASino::StaticAuthenticator do
  subject {
    described_class.new({
      users: {
        user: {
          password: 'testing123',
          fullname: 'Example User'
        }
      }
    })
  }

  context '#validate' do
    context 'with invalid credentials' do
      it 'returns false for an unknown username' do
        subject.validate('foobar', 'test').should == false
      end

      it 'returns false for a known username with wrong password' do
        subject.validate('user', 'test').should == false
      end
    end

    context 'with valid credentials' do
      let(:result) { subject.validate('user', 'testing123') }

      it 'does not return false' do
        result.should_not == false
      end

      it 'returns the username' do
        result[:username].should == 'user'
      end

      it 'returns extra attributes' do
        result[:extra_attributes][:fullname].should == 'Example User'
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
casino-4.1.2 spec/authenticator/static_spec.rb
casino-4.1.1 spec/authenticator/static_spec.rb
casino-4.1.0 spec/authenticator/static_spec.rb
casino-4.0.3 spec/authenticator/static_spec.rb
casino-4.0.2 spec/authenticator/static_spec.rb
casino-4.0.1 spec/authenticator/static_spec.rb
casino-4.0.0 spec/authenticator/static_spec.rb
casino-4.0.0.pre.2 spec/authenticator/static_spec.rb
casino-4.0.0.pre.1 spec/authenticator/static_spec.rb
casino-3.0.4 spec/authenticator/static_spec.rb
casino-2.0.7 spec/authenticator/static_spec.rb
casino-3.0.3 spec/authenticator/static_spec.rb
casino-3.0.2 spec/authenticator/static_spec.rb
casino-3.0.1 spec/authenticator/static_spec.rb
casino-3.0.0 spec/authenticator/static_spec.rb
casino-3.0.0.pre.2 spec/authenticator/static_spec.rb
casino-3.0.0.pre.1 spec/authenticator/static_spec.rb
casino-2.0.6 spec/authenticator/static_spec.rb
casino-2.0.5 spec/authenticator/static_spec.rb
casino-2.0.4 spec/authenticator/static_spec.rb