Sha256: 404e80421ae62efd96ceebd1d34c1f64429aa66e755e4d852ae1b9f733de682c

Contents?: true

Size: 635 Bytes

Versions: 8

Compression:

Stored size: 635 Bytes

Contents

require 'spec_helper'

describe SimpleTokenAuthentication::TokenGenerator do

  let(:token_generator) { SimpleTokenAuthentication::TokenGenerator.instance }

  it_behaves_like 'a token generator'

  it 'delegates token generation to Devise.friendly_token', private: true do
    devise = double()
    allow(devise).to receive(:friendly_token).and_return('FRi3ndlY_TokeN')
    stub_const('Devise', devise)

    # delegating consists in sending the message
    expect(Devise).to receive(:friendly_token)
    response = token_generator.generate_token

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
simple_token_authentication-1.18.1 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.18.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.17.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.16.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.15.1 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.15.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.14.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.13.0 spec/lib/simple_token_authentication/token_generator_spec.rb