summaryrefslogtreecommitdiff
path: root/spec/lib/mattermost/command_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/mattermost/command_spec.rb')
-rw-r--r--spec/lib/mattermost/command_spec.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb
index 7c194749dfb..847d4c06610 100644
--- a/spec/lib/mattermost/command_spec.rb
+++ b/spec/lib/mattermost/command_spec.rb
@@ -1,61 +1,61 @@
-require 'spec_helper'
+require "spec_helper"
describe Mattermost::Command do
- let(:params) { { 'token' => 'token', team_id: 'abc' } }
+ let(:params) { {"token" => "token", :team_id => "abc"} }
before do
session = Mattermost::Session.new(nil)
- session.base_uri = 'http://mattermost.example.com'
+ session.base_uri = "http://mattermost.example.com"
allow_any_instance_of(Mattermost::Client).to receive(:with_session)
.and_yield(session)
end
- describe '#create' do
+ describe "#create" do
let(:params) do
- { team_id: 'abc',
- trigger: 'gitlab' }
+ {team_id: "abc",
+ trigger: "gitlab",}
end
subject { described_class.new(nil).create(params) }
- context 'for valid trigger word' do
+ context "for valid trigger word" do
before do
- stub_request(:post, 'http://mattermost.example.com/api/v4/commands')
+ stub_request(:post, "http://mattermost.example.com/api/v4/commands")
.with(body: {
- team_id: 'abc',
- trigger: 'gitlab'
+ team_id: "abc",
+ trigger: "gitlab",
}.to_json)
.to_return(
status: 201,
- headers: { 'Content-Type' => 'application/json' },
- body: { token: 'token' }.to_json
+ headers: {"Content-Type" => "application/json"},
+ body: {token: "token"}.to_json
)
end
- it 'returns a token' do
- is_expected.to eq('token')
+ it "returns a token" do
+ is_expected.to eq("token")
end
end
- context 'for error message' do
+ context "for error message" do
before do
- stub_request(:post, 'http://mattermost.example.com/api/v4/commands')
+ stub_request(:post, "http://mattermost.example.com/api/v4/commands")
.to_return(
status: 400,
- headers: { 'Content-Type' => 'application/json' },
+ headers: {"Content-Type" => "application/json"},
body: {
- id: 'api.command.duplicate_trigger.app_error',
- message: 'This trigger word is already in use. Please choose another word.',
- detailed_error: '',
- request_id: 'obc374man7bx5r3dbc1q5qhf3r',
- status_code: 400
+ id: "api.command.duplicate_trigger.app_error",
+ message: "This trigger word is already in use. Please choose another word.",
+ detailed_error: "",
+ request_id: "obc374man7bx5r3dbc1q5qhf3r",
+ status_code: 400,
}.to_json
)
end
- it 'raises an error with message' do
- expect { subject }.to raise_error(Mattermost::Error, 'This trigger word is already in use. Please choose another word.')
+ it "raises an error with message" do
+ expect { subject }.to raise_error(Mattermost::Error, "This trigger word is already in use. Please choose another word.")
end
end
end