Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-12-20 22:56:46 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-20 22:57:09 +0300
commit4a03fae930a58b485ee610ce9e6058a2c2dd3d6e (patch)
tree418163b6578935b3660de4da67ab0e946f80acf6 /spec/lib/mattermost
parent0bd8669f3a606479e3f97683e0bfb178856df422 (diff)
Fix rspec tests due to different API
[ci skip]
Diffstat (limited to 'spec/lib/mattermost')
-rw-r--r--spec/lib/mattermost/command_spec.rb15
-rw-r--r--spec/lib/mattermost/team_spec.rb17
2 files changed, 15 insertions, 17 deletions
diff --git a/spec/lib/mattermost/command_spec.rb b/spec/lib/mattermost/command_spec.rb
index ecf336e3199..f70aee7f3e5 100644
--- a/spec/lib/mattermost/command_spec.rb
+++ b/spec/lib/mattermost/command_spec.rb
@@ -1,17 +1,22 @@
require 'spec_helper'
describe Mattermost::Command do
- let(:hash) { { 'token' => 'token' } }
- let(:user) { create(:user) }
+ 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 'creates a command' do
- described_class.new(user).
- create(team_id: 'abc', url: 'http://trigger.com')
+ 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
diff --git a/spec/lib/mattermost/team_spec.rb b/spec/lib/mattermost/team_spec.rb
index 5d1fc6fc603..ef39c456d5f 100644
--- a/spec/lib/mattermost/team_spec.rb
+++ b/spec/lib/mattermost/team_spec.rb
@@ -2,7 +2,9 @@ require 'spec_helper'
describe Mattermost::Team do
describe '#all' do
- let(:session) { double("session") }
+ let(:user) { build(:user) }
+
+ subject { described_class.new(user) }
let(:response) do
[{
@@ -20,22 +22,13 @@ describe Mattermost::Team do
"allow_open_invite" => false }]
end
- let(:json) { nil }
before do
- allow(session).to receive(:get).with('/api/v3/teams/all').
- and_return(json)
- allow(json).to receive(:parsed_response).and_return(response)
+ allow(subject).to receive(:json_get).and_return(response)
end
it 'gets the teams' do
- expect(described_class.all(session).count).to be(1)
- end
-
- it 'filters on being team admin' do
- ids = described_class.all(session).map { |team| team['id'] }
-
- expect(ids).to include("xiyro8huptfhdndadpz8r3wnbo")
+ expect(subject.all.count).to be(1)
end
end
end