Commit 1dbcd5ec authored by Matija Čupić's avatar Matija Čupić

Refactor CalloutsController

parent 8f942a05
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
......
...@@ -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
......
...@@ -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
......
Markdown is supported
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