diff --git a/app/services/exports/create.rb b/app/services/exports/create.rb index 74fadce7..c7c01718 100644 --- a/app/services/exports/create.rb +++ b/app/services/exports/create.rb @@ -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 diff --git a/spec/serializers/point_serializer_spec.rb b/spec/serializers/point_serializer_spec.rb new file mode 100644 index 00000000..fb35eeef --- /dev/null +++ b/spec/serializers/point_serializer_spec.rb @@ -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