mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
Replace global spec helpers with faster let
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user