mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Add PointSerializer spec
This commit is contained in:
parent
5df4ec8d24
commit
24726aa4d1
2 changed files with 25 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
22
spec/serializers/point_serializer_spec.rb
Normal file
22
spec/serializers/point_serializer_spec.rb
Normal 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
|
||||
Loading…
Reference in a new issue