mirror of
https://github.com/discourse/discourse.git
synced 2025-02-09 21:04:48 +00:00
This change both speeds up specs (less strings to allocate) and helps catch cases where methods in Discourse are mutating inputs. Overall we will be migrating everything to use #frozen_string_literal: true it will take a while, but this is the first and safest move in this direction
19 lines
577 B
Ruby
19 lines
577 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|