mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Make json_response test helper deal with error response
It raised an error:
NoMethodError:
undefined method `map' for nil:NilClass
This commit is contained in:
@@ -71,6 +71,15 @@ describe "Customers", type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
describe "pagination" do
|
||||
it "renders the first page" do
|
||||
pending "pagination logic compares string with integer"
|
||||
|
||||
get "/api/v1/customers", params: { page: "1" }
|
||||
expect(json_response_ids).to eq [customer1.id.to_s, customer2.id.to_s]
|
||||
end
|
||||
end
|
||||
|
||||
post "Create customer" do
|
||||
tags "Customers"
|
||||
consumes "application/json"
|
||||
|
||||
@@ -15,7 +15,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def json_response_ids
|
||||
json_response[:data].map{ |item| item["id"] }
|
||||
json_response[:data]&.map{ |item| item["id"] }
|
||||
end
|
||||
|
||||
def json_error_detail
|
||||
|
||||
Reference in New Issue
Block a user