mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
Add missing fields to Upload Fabricator (#6448)
This commit is contained in:
parent
d902bb90ae
commit
b8a1196b6b
@ -5,6 +5,8 @@ Fabricator(:upload) do
|
||||
filesize 1234
|
||||
width 100
|
||||
height 200
|
||||
thumbnail_width 30
|
||||
thumbnail_height 60
|
||||
|
||||
url do |attrs|
|
||||
sequence(:url) do |n|
|
||||
|
16
spec/serializers/upload_serializer_spec.rb
Normal file
16
spec/serializers/upload_serializer_spec.rb
Normal file
@ -0,0 +1,16 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe UploadSerializer do
|
||||
let(:upload) { Fabricate(:upload) }
|
||||
let(:subject) { UploadSerializer.new(upload, root: false) }
|
||||
|
||||
it 'should render without errors' do
|
||||
json_data = JSON.load(subject.to_json)
|
||||
|
||||
expect(json_data['id']).to eql upload.id
|
||||
expect(json_data['width']).to eql upload.width
|
||||
expect(json_data['height']).to eql upload.height
|
||||
expect(json_data['thumbnail_width']).to eql upload.thumbnail_width
|
||||
expect(json_data['thumbnail_height']).to eql upload.thumbnail_height
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user