dawarich/spec/serializers/api/slim_point_serializer_spec.rb
2025-02-22 23:14:23 +01:00

23 lines
555 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::SlimPointSerializer do
describe '#call' do
subject(:serializer) { described_class.new(point).call }
let!(:point) { create(:point, :with_known_location) }
let(:expected_json) do
{
id: point.id,
latitude: point.lat.to_s,
longitude: point.lon.to_s,
timestamp: point.timestamp
}
end
it 'returns JSON with correct attributes' do
expect(serializer.to_json).to eq(expected_json.to_json)
end
end
end