Add PointSerializer spec

This commit is contained in:
Eugene Burmakin 2024-09-02 21:56:48 +02:00
parent 5df4ec8d24
commit 24726aa4d1
2 changed files with 25 additions and 2 deletions

View file

@ -13,11 +13,12 @@ class Exports::Create
export.update!(status: :processing)
points = time_framed_points
data = points_data(points)
data = points_data(points)
create_export_file(data)
export.update!(status: :completed, url: "exports/#{export.name}.#{format}")
export.update!(status: :completed, url: "exports/#{export.name}.#{file_format}")
create_export_finished_notification
rescue StandardError => e

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PointSerializer do
describe '#call' do
subject(:serializer) { described_class.new(point).call }
let(:point) { create(:point) }
let(:expected_json) do
point.attributes.except(*PointSerializer::EXCLUDED_ATTRIBUTES)
end
it 'returns JSON' do
expect(serializer.to_json).to eq(expected_json.to_json)
end
it 'does not include excluded attributes' do
expect(serializer).not_to include(*PointSerializer::EXCLUDED_ATTRIBUTES)
end
end
end