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

Remove duplication of implementations

parent 7c1cea29d933
class ChatOpsController < ApplicationController
respond_to :json
skip_before_action :verify_authenticity_token
skip_before_action :authenticate_user!
def trigger
render json: { ok: true }
# 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 @@ def supported_events ...@@ -12,7 +13,7 @@ def supported_events
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 @@ def title ...@@ -5,7 +5,7 @@ def title
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 @@ ...@@ -68,11 +68,6 @@
# 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
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)
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