summaryrefslogtreecommitdiff
path: root/spec/lib/mattermost/command_spec.rb
blob: f70aee7f3e515b6203ee69d5fbf6ee7db76b3f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

describe Mattermost::Command do
  let(:params) { { 'token' => 'token', team_id: 'abc' } }
  let(:user) { build(:user) }

  before do
    Mattermost::Session.base_uri("http://mattermost.example.com")
  end

  subject { described_class.new(user) }

  describe '#create' do
    it 'interpolates the team id' do
      allow(subject).to receive(:json_post).
        with('/api/v3/teams/abc/commands/create', body: params.to_json).
        and_return('token' => 'token')

      subject.create(params)
    end
  end
end