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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-16 14:20:42 +0300
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-17 12:31:14 +0300
commite663725961de66ac838d0a5a85978656938e74f4 (patch)
tree1342f0caa56b37e02710b25f272969dfedfce902 /spec/lib/mattermost
parent48ebfaa49146b8f6fcb24b063f22d553b2f20395 (diff)
Store mattermost_url in settings
Diffstat (limited to 'spec/lib/mattermost')
-rw-r--r--spec/lib/mattermost/session_spec.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/lib/mattermost/session_spec.rb b/spec/lib/mattermost/session_spec.rb
index 69d677930bc..3c2eddbd221 100644
--- a/spec/lib/mattermost/session_spec.rb
+++ b/spec/lib/mattermost/session_spec.rb
@@ -6,7 +6,7 @@ describe Mattermost::Session, type: :request do
let(:gitlab_url) { "http://gitlab.com" }
let(:mattermost_url) { "http://mattermost.com" }
- subject { described_class.new(mattermost_url, user) }
+ subject { described_class.new(user) }
# Needed for doorkeeper to function
it { is_expected.to respond_to(:current_resource_owner) }
@@ -14,6 +14,10 @@ describe Mattermost::Session, type: :request do
it { is_expected.to respond_to(:authorization) }
it { is_expected.to respond_to(:strategy) }
+ before do
+ described_class.base_uri(mattermost_url)
+ end
+
describe '#with session' do
let(:location) { 'http://location.tld' }
let!(:stub) do
@@ -72,18 +76,22 @@ describe Mattermost::Session, type: :request do
end
WebMock.stub_request(:post, "#{mattermost_url}/api/v3/users/logout").
- to_return(headers: { Cookie: 'MMAUTHTOKEN=thisworksnow' }, status: 200)
+ to_return(headers: { Authorization: 'token thisworksnow' }, status: 200)
end
it 'can setup a session' do
- subject.with_session { 1 + 1 }
+ subject.with_session do |session|
+ end
+
expect(subject.token).not_to be_nil
end
it 'returns the value of the block' do
- value = subject.with_session { 1 + 1 }
+ result = subject.with_session do |session|
+ "value"
+ end
- expect(value).to be(2)
+ expect(result).to eq("value")
end
end
end