diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-19 16:14:09 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-19 23:44:15 +0300 |
commit | d21535602b30316646772b1cd74d7069254076df (patch) | |
tree | d5e7533b44d646e8aaee153ce7b0f51e9467faa7 /spec/lib/mattermost/command_spec.rb | |
parent | 4213bd56dea1d6cdbfa8baed8faa7e3ab86e61ab (diff) |
Minor adjustments API Mattermost
[ci skip]
Diffstat (limited to 'spec/lib/mattermost/command_spec.rb')
-rw-r--r-- | spec/lib/mattermost/command_spec.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb index 7c6457f639d..bc2e47ebbc9 100644 --- a/spec/lib/mattermost/command_spec.rb +++ b/spec/lib/mattermost/command_spec.rb @@ -1,17 +1,25 @@ require 'spec_helper' describe Mattermost::Command do + let(:session) { double("session") } + let(:hash) { { 'token' => 'token' } } + describe '.create' do - let(:new_command) do - JSON.parse(File.read(Rails.root.join('spec/fixtures/', 'mattermost_new_command.json'))) + before do + allow(session).to receive(:post).and_return(hash) + allow(hash).to receive(:parsed_response).and_return(hash) end - it 'gets the teams' do - allow(described_class).to receive(:post_command).and_return(new_command) + context 'with access' do + it 'gets the teams' do + expect(session).to receive(:post) + + described_class.create(session, 'abc', url: 'http://trigger.com') + end + end - token = described_class.create('abc', url: 'http://trigger.url/trigger', icon_url: 'http://myicon.com/icon.png') + context 'on an error' do - expect(token).to eq('pzajm5hfbtni3r49ujpt8betpc') end end end |