Skip to content
Snippets Groups Projects
Commit 47621989 authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Remove duplication of implementations

parent 9191f538
No related branches found
No related tags found
No related merge requests found
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'
 
Loading
Loading
@@ -12,7 +13,7 @@ class ChatService < Service
end
 
def trigger(params)
# implement inside child
raise NotImplementedError
end
 
def chat_user_params(params)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment