Replace global spec helpers with faster let

This commit is contained in:
Maikel Linke
2025-10-10 16:39:15 +11:00
parent 378b5e656e
commit d3319cfd69
2 changed files with 2 additions and 8 deletions

View File

@@ -19,6 +19,8 @@ RSpec.describe "Customers", swagger_doc: "v1.yaml", feature: :api_v1 do
}
let!(:customer2) { create(:customer, enterprise: enterprise1, created_manually: true,) }
let!(:customer3) { create(:customer, enterprise: enterprise2, created_manually: true,) }
let(:json_response_ids) { json_response[:data]&.pluck(:id) }
let(:json_error_detail) { json_response[:errors][0][:detail] }
before do
login_as enterprise1.owner

View File

@@ -6,14 +6,6 @@ module OpenFoodNetwork
response.parsed_body
end
def json_response_ids
json_response[:data]&.pluck(:id)
end
def json_error_detail
json_response[:errors][0][:detail]
end
def assert_unauthorized!
expect(json_response).to eq("error" => "You are not authorized to perform that action.")
expect(response).to have_http_status :unauthorized