Sha256: 97f43009593c2aa5d023515f72c9949e9c3c4fcaec668a21b8390aa32eb19a81

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'casino/test_authenticator'

describe CASino::TestAuthenticator do
  let(:options) { { } }
  let(:subject) { described_class.new(options) }
  let(:connection) { Object.new }


  describe '#validate' do
    let(:username) { 'test' }

    context 'when validation succeeds' do
      let(:password) { 'test' }
      it 'returns the user data' do
        subject.validate(username, password).should == {
          username: username,
          extra_attributes: nil
        }
      end
      
    end

    context 'when validation fails' do
      let(:password) { 'foo' }
      it 'returns false' do
        subject.validate(username, password).should == false
      end
    end

    context 'when a mail attribute is required' do
      let (:options) { { mail: true } }
      let (:password) { 'test' }
      it 'returns a mail attribute' do 
        res = subject.validate(username, password)
        res.should have_key(:extra_attributes)
        res[:extra_attributes][:mail].should be_a_kind_of(String)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casino-test_authenticator-1.2.0 spec/casino/test_authenticator_spec.rb