Commit 66a9d7ad authored by Matija Čupić's avatar Matija Čupić

Refactor CalloutsController

parent 01a5ccb3
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
......
......@@ -77,9 +77,7 @@ Rails.application.routes.draw do
end
# Callouts
namespace :callouts do
post :dismiss
end
resources :callouts, only: [:create]
end
# Koding route
......
......@@ -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
......
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