Sha256: dffc309a92ef900a14f0ad5c9823bbfe00523c4a99f590e4c0ea925bf6cfe3ab

Contents?: true

Size: 547 Bytes

Versions: 11

Compression:

Stored size: 547 Bytes

Contents

require 'spec_helper'

describe SimpleTokenAuthentication::TokenGenerator do

  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 = subject.generate_token

    # and returning the response
    expect(response).to eq 'FRi3ndlY_TokeN'
  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_generator_spec.rb
simple_token_authentication-1.11.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.10.1 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.10.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.9.1 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.9.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.8.0 spec/lib/simple_token_authentication/token_generator_spec.rb
stn-simple_token_authentication-1.7.1 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.7.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.6.0 spec/lib/simple_token_authentication/token_generator_spec.rb
simple_token_authentication-1.5.2 spec/lib/simple_token_authentication/token_generator_spec.rb