Sha256: b2398c6bacac678e21804caa438593d9fcd0ab21bbad07532b4cf8af2cd2e811

Contents?: true

Size: 707 Bytes

Versions: 3

Compression:

Stored size: 707 Bytes

Contents

%w{
tempfile

murlsh
}.each { |m| require m }

describe Murlsh::Auth do

  before do
    @f = Tempfile.new('murlsh_users_test')

    @a = Murlsh::Auth.new(@f.path)

    @a.add_user('test1', 'test1@test.com', 'secret1')
    @a.add_user('test2', 'test2@test.com', 'secret2')
  end

  after do; @f.close!; end

  it 'should authorize valid credentials' do
    @a.auth('secret1').should == {
      :name => 'test1',
      :email => Digest::MD5.hexdigest('test1@test.com')
      }
    @a.auth('secret2').should == {
      :name => 'test2',
      :email => Digest::MD5.hexdigest('test2@test.com')
      }
  end

  it 'should not authorize invalid credentials' do
    @a.auth('not there').should be_nil
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
murlsh-1.0.0 spec/auth_spec.rb
murlsh-0.11.0 spec/auth_spec.rb
murlsh-0.10.0 spec/auth_spec.rb