mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 03:03:00 +08:00
e219588142
* Introduced fab!, a helper that creates database state for a group It's almost identical to let_it_be, except: 1. It creates a new object for each test by default, 2. You can disable it using PREFABRICATION=0
19 lines
578 B
Ruby
19 lines
578 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe UploadSerializer do
|
|
fab!(: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
|