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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1dbcd5ec
Commit
1dbcd5ec
authored
Feb 02, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor CalloutsController
parent
8f942a05
Changes
3
Show 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 @
1dbcd5ec
class
CalloutsController
<
ApplicationController
class
CalloutsController
<
ApplicationController
def
dismiss
def
create
if
ensure_callout
if
ensure_callout
respond_to
{
|
format
|
format
.
json
{
head
:ok
}
}
respond_to
do
|
format
|
format
.
json
{
head
:ok
}
end
else
else
respond_to
{
|
format
|
format
.
json
{
head
:bad_request
}
}
respond_to
do
|
format
|
format
.
json
{
head
:bad_request
}
end
end
end
end
end
...
...
config/routes.rb
View file @
1dbcd5ec
...
@@ -62,9 +62,7 @@ Rails.application.routes.draw do
...
@@ -62,9 +62,7 @@ Rails.application.routes.draw do
end
end
# Callouts
# Callouts
namespace
:callouts
do
resources
:callouts
,
only:
[
:create
]
post
:dismiss
end
end
end
# Koding route
# Koding route
...
...
spec/controllers/callouts_controller_spec.rb
View file @
1dbcd5ec
...
@@ -7,8 +7,8 @@ describe CalloutsController do
...
@@ -7,8 +7,8 @@ describe CalloutsController do
sign_in
(
user
)
sign_in
(
user
)
end
end
describe
"POST #
dismiss
"
do
describe
"POST #
create
"
do
subject
{
post
:
dismiss
,
feature_name:
'feature_name'
,
format: :json
}
subject
{
post
:
create
,
feature_name:
'feature_name'
,
format: :json
}
context
'when callout entry does not exist'
do
context
'when callout entry does not exist'
do
it
'should create a callout entry with dismissed state'
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