Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions app/services/json_serializer_service.rb

This file was deleted.

7 changes: 4 additions & 3 deletions spec/requests/api/units_json_inspection_history_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@
expect(unit_with_inspections.inspections.first.complete?).to eq(true)
end

it "returns correct data when called directly on model" do
# Test the serializer directly
json = JsonSerializerService.serialize_unit(unit.reload)
it "returns correct data through the API endpoint" do
# Test through the actual endpoint
get "/units/#{unit.id}.json"
json = JSON.parse(response.body, symbolize_names: true)

expect(json[:inspection_history]).to be_present
expect(json[:inspection_history].length).to eq(1)
Expand Down
4 changes: 0 additions & 4 deletions spec/requests/api/units_json_real_world_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
found_unit = Unit.find_by(id: unit.id.upcase)
expect(found_unit).to eq(unit)

# Test serializer directly with the found unit
json = JsonSerializerService.serialize_unit(found_unit)
expect(json[:inspection_history]).to be_present

# Now test through the actual endpoint
get "/units/#{unit.id}.json"
response_json = JSON.parse(response.body)
Expand Down
7 changes: 5 additions & 2 deletions spec/requests/inspections/inspections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,14 @@ def mock_failing_update(error_messages = ["Update error"])
end

it "serves JSON via .json format" do
allow(JsonSerializerService).to receive(:serialize_inspection).and_return({id: inspection.id})

get "/inspections/#{inspection.id}.json"
expect(response).to have_http_status(:success)
expect(response.content_type).to include("application/json")

json = JSON.parse(response.body)
expect(json).to be_present
expect(json).to have_key("complete")
expect(json).to have_key("urls")
end

it "serves QR code via .png format" do
Expand Down
258 changes: 0 additions & 258 deletions spec/services/json_serializer_service_spec.rb

This file was deleted.

Loading