Commit 1db1896e authored by Kamil Trzcinski's avatar Kamil Trzcinski

Rename mattermost_command to mattermost_slash_commands

parent c72c76fd
...@@ -92,7 +92,7 @@ class Project < ActiveRecord::Base ...@@ -92,7 +92,7 @@ class Project < ActiveRecord::Base
has_one :assembla_service, dependent: :destroy has_one :assembla_service, dependent: :destroy
has_one :asana_service, dependent: :destroy has_one :asana_service, dependent: :destroy
has_one :gemnasium_service, dependent: :destroy has_one :gemnasium_service, dependent: :destroy
has_one :mattermost_command_service, dependent: :destroy has_one :mattermost_slash_commands_service, dependent: :destroy
has_one :slack_service, dependent: :destroy has_one :slack_service, dependent: :destroy
has_one :buildkite_service, dependent: :destroy has_one :buildkite_service, dependent: :destroy
has_one :bamboo_service, dependent: :destroy has_one :bamboo_service, dependent: :destroy
......
class MattermostCommandService < ChatService class MattermostSlashCommandsService < ChatService
include TriggersHelper include TriggersHelper
prop_accessor :token prop_accessor :token
...@@ -16,7 +16,7 @@ class MattermostCommandService < ChatService ...@@ -16,7 +16,7 @@ class MattermostCommandService < ChatService
end end
def to_param def to_param
'mattermost_command' 'mattermost_slash_commands'
end end
def help def help
......
...@@ -213,7 +213,7 @@ class Service < ActiveRecord::Base ...@@ -213,7 +213,7 @@ class Service < ActiveRecord::Base
hipchat hipchat
irker irker
jira jira
mattermost_command mattermost_slash_commands
pipelines_email pipelines_email
pivotaltracker pivotaltracker
pushover pushover
......
...@@ -128,7 +128,7 @@ project: ...@@ -128,7 +128,7 @@ project:
- emails_on_push_service - emails_on_push_service
- builds_email_service - builds_email_service
- pipelines_email_service - pipelines_email_service
- mattermost_command_service - mattermost_slash_commands_service
- irker_service - irker_service
- pivotaltracker_service - pivotaltracker_service
- hipchat_service - hipchat_service
......
require 'spec_helper' require 'spec_helper'
describe MattermostCommandService, models: true do describe MattermostSlashCommandsService, models: true do
describe "Associations" do describe "Associations" do
it { is_expected.to respond_to :token } it { is_expected.to respond_to :token }
end end
...@@ -66,7 +66,7 @@ describe MattermostCommandService, models: true do ...@@ -66,7 +66,7 @@ describe MattermostCommandService, models: true do
end end
let(:service) do let(:service) do
project.create_mattermost_command_service( project.create_mattermost_slash_commands_service(
properties: { token: 'token' } properties: { token: 'token' }
) )
end end
...@@ -82,7 +82,7 @@ describe MattermostCommandService, models: true do ...@@ -82,7 +82,7 @@ describe MattermostCommandService, models: true do
context 'when the user is authenticated' do context 'when the user is authenticated' do
let!(:chat_name) { create(:chat_name, service: service) } let!(:chat_name) { create(:chat_name, service: service) }
let(:service) do let(:service) do
project.create_mattermost_command_service( project.create_mattermost_slash_commands_service(
properties: { token: 'token' } properties: { token: 'token' }
) )
end end
......
...@@ -36,7 +36,7 @@ describe Project, models: true do ...@@ -36,7 +36,7 @@ describe Project, models: true do
it { is_expected.to have_one(:hipchat_service).dependent(:destroy) } it { is_expected.to have_one(:hipchat_service).dependent(:destroy) }
it { is_expected.to have_one(:flowdock_service).dependent(:destroy) } it { is_expected.to have_one(:flowdock_service).dependent(:destroy) }
it { is_expected.to have_one(:assembla_service).dependent(:destroy) } it { is_expected.to have_one(:assembla_service).dependent(:destroy) }
it { is_expected.to have_one(:mattermost_command_service).dependent(:destroy) } it { is_expected.to have_one(:mattermost_slash_commands_service).dependent(:destroy) }
it { is_expected.to have_one(:gemnasium_service).dependent(:destroy) } it { is_expected.to have_one(:gemnasium_service).dependent(:destroy) }
it { is_expected.to have_one(:buildkite_service).dependent(:destroy) } it { is_expected.to have_one(:buildkite_service).dependent(:destroy) }
it { is_expected.to have_one(:bamboo_service).dependent(:destroy) } it { is_expected.to have_one(:bamboo_service).dependent(:destroy) }
......
...@@ -91,7 +91,7 @@ describe API::API, api: true do ...@@ -91,7 +91,7 @@ describe API::API, api: true do
describe 'POST /projects/:id/services/:slug/trigger' do describe 'POST /projects/:id/services/:slug/trigger' do
let!(:project) { create(:empty_project) } let!(:project) { create(:empty_project) }
let(:service_name) { 'mattermost_command' } let(:service_name) { 'mattermost_slash_commands' }
context 'no service is available' do context 'no service is available' do
it 'returns a not found message' do it 'returns a not found message' do
...@@ -107,14 +107,14 @@ describe API::API, api: true do ...@@ -107,14 +107,14 @@ describe API::API, api: true do
context 'the service is not active' do context 'the service is not active' do
let!(:inactive_service) do let!(:inactive_service) do
project.create_mattermost_command_service( project.create_mattermost_slash_commands_service(
active: false, active: false,
properties: { token: 'token' } properties: { token: 'token' }
) )
end end
it 'when the service is inactive' do it 'when the service is inactive' do
post api("/projects/#{project.id}/services/mattermost_command/trigger") post api("/projects/#{project.id}/services/mattermost_slash_commands/trigger")
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
...@@ -122,14 +122,14 @@ describe API::API, api: true do ...@@ -122,14 +122,14 @@ describe API::API, api: true do
context 'the service is active' do context 'the service is active' do
let!(:active_service) do let!(:active_service) do
project.create_mattermost_command_service( project.create_mattermost_slash_commands_service(
active: true, active: true,
properties: { token: 'token' } properties: { token: 'token' }
) )
end end
it 'retusn status 200' do it 'retusn status 200' do
post api("/projects/#{project.id}/services/mattermost_command/trigger"), params post api("/projects/#{project.id}/services/mattermost_slash_commands/trigger"), params
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
...@@ -137,7 +137,7 @@ describe API::API, api: true do ...@@ -137,7 +137,7 @@ describe API::API, api: true do
context 'when the project can not be found' do context 'when the project can not be found' do
it 'returns a generic 404' do it 'returns a generic 404' do
post api("/projects/404/services/mattermost_command/trigger"), params post api("/projects/404/services/mattermost_slash_commands/trigger"), params
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
expect(json_response["message"]).to eq("404 Service Not Found") expect(json_response["message"]).to eq("404 Service Not Found")
......
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