Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
66a9d7ad
Commit
66a9d7ad
authored
Feb 02, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor CalloutsController
parent
01a5ccb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
app/controllers/callouts_controller.rb
app/controllers/callouts_controller.rb
+7
-3
config/routes.rb
config/routes.rb
+1
-3
spec/controllers/callouts_controller_spec.rb
spec/controllers/callouts_controller_spec.rb
+2
-2
No files found.
app/controllers/callouts_controller.rb
View file @
66a9d7ad
class
CalloutsController
<
ApplicationController
def
dismiss
def
create
if
ensure_callout
respond_to
{
|
format
|
format
.
json
{
head
:ok
}
}
respond_to
do
|
format
|
format
.
json
{
head
:ok
}
end
else
respond_to
{
|
format
|
format
.
json
{
head
:bad_request
}
}
respond_to
do
|
format
|
format
.
json
{
head
:bad_request
}
end
end
end
...
...
config/routes.rb
View file @
66a9d7ad
...
...
@@ -77,9 +77,7 @@ Rails.application.routes.draw do
end
# Callouts
namespace
:callouts
do
post
:dismiss
end
resources
:callouts
,
only:
[
:create
]
end
# Koding route
...
...
spec/controllers/callouts_controller_spec.rb
View file @
66a9d7ad
...
...
@@ -7,8 +7,8 @@ describe CalloutsController do
sign_in
(
user
)
end
describe
"POST #
dismiss
"
do
subject
{
post
:
dismiss
,
feature_name:
'feature_name'
,
format: :json
}
describe
"POST #
create
"
do
subject
{
post
:
create
,
feature_name:
'feature_name'
,
format: :json
}
context
'when callout entry does not exist'
do
it
'should create a callout entry with dismissed state'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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