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
# This class is not meant to be used directly, but only to inherrit from.
class ChatService < Service
default_value_for :category, 'chat'
......@@ -12,7 +13,7 @@ class ChatService < Service
end
def trigger(params)
# implement inside child
raise NotImplementedError
end
def chat_user_params(params)
......
......@@ -5,7 +5,7 @@ class MattermostChatService < ChatService
end
def description
'Self-hosted Slack-alternative'
'Mattermost is an open source, self-hosted Slack-alternative'
end
def to_param
......
......@@ -68,11 +68,6 @@ Rails.application.routes.draw do
# Notification settings
resources :notification_settings, only: [:create, :update]
# For slash commands to POST
namespace :chat_ops do
post :trigger
end
draw :import
draw :uploads
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