Sha256: ea65866d464c714e8933cc7f2c73f260707f53005237c85b453c64d3c2064c77

Contents?: true

Size: 1.68 KB

Versions: 5

Compression:

Stored size: 1.68 KB

Contents

describe Unidom::Visitor::Authenticating, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    model_attributes = {
      visitor_id:      SecureRandom.uuid,
      visitor_type:    'Unidom::Visitor::Visitor::Mock',
      credential_id:   SecureRandom.uuid,
      credential_type: 'Unidom::Visitor::Credential::Mock',
      flag_code:       Unidom::Visitor::Flag::REQUIRED.code
    }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes

    it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :flag, Unidom::Visitor::Flag

    user_attributes     = {}
    guest_attributes    = { platform_code: 'SITE', platform_specific_identification: '123456789012' }
    password_attributes = { clear_text: 'password' }

    it_behaves_like 'belongs_to', model_attributes, :visitor,    Unidom::Visitor::User,     user_attributes
    it_behaves_like 'belongs_to', model_attributes, :visitor,    Unidom::Visitor::Guest,    guest_attributes
    it_behaves_like 'belongs_to', model_attributes, :credential, Unidom::Visitor::Password, password_attributes

    it_behaves_like 'polymorphic scope', model_attributes, :visitor_is,    :visitor,    [ Unidom::Visitor::User, Unidom::Visitor::Guest ]
    it_behaves_like 'polymorphic scope', model_attributes, :credential_is, :credential, [ Unidom::Visitor::Password                     ]

    visitor  = Unidom::Visitor::User.create!     user_attributes
    password = Unidom::Visitor::Password.create! password_attributes
    it_behaves_like 'assert_present!', described_class, :authenticate!, [ visitor, { with: password, opened_at: Time.now } ], [ { 0 => :visitor }, :with, :opened_at ]

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unidom-visitor-2.0 lib/rspec/models/unidom/visitor/authenticating_spec.rb
unidom-visitor-1.13.10 lib/rspec/models/unidom/visitor/authenticating_spec.rb
unidom-visitor-1.13.9 lib/rspec/models/unidom/visitor/authenticating_spec.rb
unidom-visitor-1.13.8 lib/rspec/models/unidom/visitor/authenticating_spec.rb
unidom-visitor-1.13.7 lib/rspec/models/unidom/visitor/authenticating_spec.rb