2021-09-07 14:06:13 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative '../../../plugin_helper'
|
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
describe CustomWizard::Subscription::AuthenticationSerializer do
|
2021-09-07 14:06:13 +02:00
|
|
|
fab!(:user) { Fabricate(:user) }
|
|
|
|
|
2021-09-24 11:58:42 +02:00
|
|
|
it 'should return subscription authentication attributes' do
|
|
|
|
auth = CustomWizard::Subscription::Authentication.new(OpenStruct.new(key: '1234', auth_at: Time.now, auth_by: user.id))
|
2021-09-07 14:06:13 +02:00
|
|
|
serialized = described_class.new(auth, root: false).as_json
|
|
|
|
|
|
|
|
expect(serialized[:active]).to eq(true)
|
|
|
|
expect(serialized[:client_id]).to eq(auth.client_id)
|
|
|
|
expect(serialized[:auth_by]).to eq(auth.auth_by)
|
|
|
|
expect(serialized[:auth_at]).to eq(auth.auth_at)
|
|
|
|
end
|
|
|
|
end
|