2017-03-24 20:20:36 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe WebHookUserSerializer do
|
2018-01-21 18:09:26 -05:00
|
|
|
let(:user) do
|
|
|
|
user = Fabricate(:user)
|
|
|
|
SingleSignOnRecord.create!(user_id: user.id, external_id: '12345', last_payload: '')
|
|
|
|
user
|
|
|
|
end
|
2017-03-24 20:20:36 -04:00
|
|
|
|
2018-01-21 18:09:26 -05:00
|
|
|
let(:admin) { Fabricate(:admin) }
|
2017-03-24 20:20:36 -04:00
|
|
|
|
2018-01-21 18:09:26 -05:00
|
|
|
let :serializer do
|
|
|
|
WebHookUserSerializer.new(user, scope: Guardian.new(admin), root: false)
|
|
|
|
end
|
2017-03-24 20:20:36 -04:00
|
|
|
|
2018-01-21 18:09:26 -05:00
|
|
|
it "should include relevant user info" do
|
|
|
|
payload = serializer.as_json
|
2017-03-24 20:20:36 -04:00
|
|
|
expect(payload[:email]).to eq(user.email)
|
2018-01-21 18:09:26 -05:00
|
|
|
expect(payload[:external_id]).to eq('12345')
|
2017-03-24 20:20:36 -04:00
|
|
|
end
|
|
|
|
end
|