discourse/spec/serializers/reviewable_user_serializer_spec.rb
Robin Ward b58867b6e9 FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API
backwards compatibility.

Co-Authored-By: romanrizzi <romanalejandro@gmail.com>
Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
2019-03-28 12:45:10 -04:00

17 lines
528 B
Ruby

require 'rails_helper'
describe ReviewableUserSerializer do
let(:reviewable) { Fabricate(:reviewable) }
let(:admin) { Fabricate(:admin) }
it "includes the user fields for review" do
json = ReviewableUserSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_json
expect(json[:user_id]).to eq(reviewable.target_id)
expect(json[:username]).to eq(reviewable.target.username)
expect(json[:email]).to eq(reviewable.target.email)
expect(json[:name]).to eq(reviewable.target.name)
end
end