fix: Add not found status if macro not found (#5473)
This commit is contained in:
@@ -16,7 +16,9 @@ class Api::V1::Accounts::MacrosController < Api::V1::Accounts::BaseController
|
|||||||
@macro.save!
|
@macro.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
def show
|
||||||
|
head :not_found if @macro.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@macro.destroy!
|
@macro.destroy!
|
||||||
|
|||||||
@@ -173,6 +173,13 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
|||||||
expect(json_response['payload']['name']).to eql(macro.name)
|
expect(json_response['payload']['name']).to eql(macro.name)
|
||||||
expect(json_response['payload']['created_by']['id']).to eql(administrator.id)
|
expect(json_response['payload']['created_by']['id']).to eql(administrator.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'return not_found status when macros not available' do
|
||||||
|
get "/api/v1/accounts/#{account.id}/macros/15",
|
||||||
|
headers: administrator.create_new_auth_token
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:not_found)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user