Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
1d261c7c
Commit
1d261c7c
authored
2 years ago
by
Eugen Rochko
Browse files
Options
Download
Email Patches
Plain Diff
Fix #19173
parent
c8ca4cc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/api/v1/admin/domain_allows_controller.rb
+2
-6
app/controllers/api/v1/admin/domain_allows_controller.rb
spec/controllers/api/v1/admin/domain_allows_controller_spec.rb
+10
-0
...controllers/api/v1/admin/domain_allows_controller_spec.rb
with
12 additions
and
6 deletions
+12
-6
app/controllers/api/v1/admin/domain_allows_controller.rb
+
2
-
6
View file @
1d261c7c
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/api/v1/admin/domain_allows_controller_spec.rb
+
10
-
0
View file @
1d261c7c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets