Commit 47621989 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Remove duplication of implementations

parent 9191f538
class ChatOpsController < ApplicationController
respond_to :json
skip_before_action :verify_authenticity_token
skip_before_action :authenticate_user!
def trigger
render json: { ok: true }
end
end
# Base class for Chat services # Base class for Chat services
# This class is not meant to be used directly, but only to inherrit from.
class ChatService < Service class ChatService < Service
default_value_for :category, 'chat' default_value_for :category, 'chat'
...@@ -12,7 +13,7 @@ class ChatService < Service ...@@ -12,7 +13,7 @@ class ChatService < Service
end end
def trigger(params) def trigger(params)
# implement inside child raise NotImplementedError
end end
def chat_user_params(params) def chat_user_params(params)
......
...@@ -5,7 +5,7 @@ class MattermostChatService < ChatService ...@@ -5,7 +5,7 @@ class MattermostChatService < ChatService
end end
def description def description
'Self-hosted Slack-alternative' 'Mattermost is an open source, self-hosted Slack-alternative'
end end
def to_param def to_param
......
...@@ -68,11 +68,6 @@ Rails.application.routes.draw do ...@@ -68,11 +68,6 @@ Rails.application.routes.draw do
# Notification settings # Notification settings
resources :notification_settings, only: [:create, :update] resources :notification_settings, only: [:create, :update]
# For slash commands to POST
namespace :chat_ops do
post :trigger
end
draw :import draw :import
draw :uploads draw :uploads
draw :explore draw :explore
......
require 'rails_helper'
RSpec.describe ChatOpsController, type: :controller do
describe "POST #trigger" do
it "returns http success" do
post :trigger
expect(response).to have_http_status(:success)
end
end
end
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