Commit 1d261c7c authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Fix #19173

parent c8ca4cc5
Showing with 12 additions and 6 deletions
+12 -6
......@@ -19,12 +19,8 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
def create
authorize :domain_allow, :create?
@domain_allow = DomainAllow.find_by(resource_params)
if @domain_allow.nil?
@domain_allow = DomainAllow.create!(resource_params)
log_action :create, @domain_allow
end
@domain_allow = DomainAllow.create!(resource_params)
log_action :create, @domain_allow
render json: @domain_allow, serializer: REST::Admin::DomainAllowSerializer
end
......
......@@ -126,5 +126,15 @@ RSpec.describe Api::V1::Admin::DomainAllowsController, type: :controller do
expect(response).to have_http_status(422)
end
end
context 'with no domain name' do
before do
post :create
end
it 'returns http unprocessable entity' do
expect(response).to have_http_status(422)
end
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment