1
0
Fork 0
discourse-custom-wizard-unl.../spec/serializers/custom_wizard/pro/authentication_serializer_spec.rb
2021-09-07 20:06:13 +08:00

17 Zeilen
613 B
Ruby

# frozen_string_literal: true
require_relative '../../../plugin_helper'
describe CustomWizard::ProAuthenticationSerializer do
fab!(:user) { Fabricate(:user) }
it 'should return pro authentication attributes' do
auth = CustomWizard::ProAuthentication.new(OpenStruct.new(key: '1234', auth_at: Time.now, auth_by: user.id))
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