summaryrefslogtreecommitdiff
path: root/qa/spec/runtime/api_client_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-01-23 13:04:58 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-01-23 13:04:58 +0100
commit41498864a083663fa29131f8af74c69e82213055 (patch)
treeb838012a9480b20acb9b80ba9a2bd5e649d117e4 /qa/spec/runtime/api_client_spec.rb
parentd327277c39df1537b41073912d9b4e9f765d8da5 (diff)
parent4dc42845f2ceadcff76a99908220e61610c5b608 (diff)
downloadgitlab-ce-41498864a083663fa29131f8af74c69e82213055.tar.gz
Merge branch 'master' into qa/gb/ci-cd-qa-pipelines
* master: (69 commits) Conflicts: qa/qa.rb
Diffstat (limited to 'qa/spec/runtime/api_client_spec.rb')
-rw-r--r--qa/spec/runtime/api_client_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/qa/spec/runtime/api_client_spec.rb b/qa/spec/runtime/api_client_spec.rb
new file mode 100644
index 00000000000..d497d8839b8
--- /dev/null
+++ b/qa/spec/runtime/api_client_spec.rb
@@ -0,0 +1,30 @@
+describe QA::Runtime::API::Client do
+ include Support::StubENV
+
+ describe 'initialization' do
+ it 'defaults to :gitlab address' do
+ expect(described_class.new.address).to eq :gitlab
+ end
+
+ it 'uses specified address' do
+ client = described_class.new('http:///example.com')
+
+ expect(client.address).to eq 'http:///example.com'
+ end
+ end
+
+ describe '#get_personal_access_token' do
+ it 'returns specified token from env' do
+ stub_env('PERSONAL_ACCESS_TOKEN', 'a_token')
+
+ expect(described_class.new.get_personal_access_token).to eq 'a_token'
+ end
+
+ it 'returns a created token' do
+ allow_any_instance_of(described_class)
+ .to receive(:create_personal_access_token).and_return('created_token')
+
+ expect(described_class.new.get_personal_access_token).to eq 'created_token'
+ end
+ end
+end