Sha256: 31b13bad9ce629e8ffdd09c8f666d0d1d45e3ea5a970b39e4502d2497202e7bc

Contents?: true

Size: 610 Bytes

Versions: 11

Compression:

Stored size: 610 Bytes

Contents

require 'spec_helper'

describe SimpleTokenAuthentication::TokenComparator do

  it_behaves_like 'a token comparator'

  it 'delegates token comparison to Devise.secure_compare', private: true do
    devise = double()
    allow(devise).to receive(:secure_compare).and_return('Devise.secure_compare response.')
    stub_const('Devise', devise)

    # delegating consists in sending the message
    expect(Devise).to receive(:secure_compare)
    response = subject.compare('A_raNd0MtoKeN', 'ano4heR-Tok3n')

    # and returning the response
    expect(response).to eq 'Devise.secure_compare response.'
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
simple_token_authentication-1.12.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.11.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.10.1 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.10.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.9.1 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.9.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.8.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
stn-simple_token_authentication-1.7.1 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.7.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.6.0 spec/lib/simple_token_authentication/token_comparator_spec.rb
simple_token_authentication-1.5.2 spec/lib/simple_token_authentication/token_comparator_spec.rb