summaryrefslogtreecommitdiff
path: root/qa/spec/runtime/env_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-10-17 18:08:20 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-10-17 18:08:20 +0000
commitb6f2f738c73b1dfe66be61e1b37ca21fa698cf1c (patch)
treeb6b520d12c2051a6a1cdaa5741f48f6583e0cce8 /qa/spec/runtime/env_spec.rb
parentab9cf561c230f1b6ec630215a9a9def53e14d764 (diff)
downloadgitlab-ce-b6f2f738c73b1dfe66be61e1b37ca21fa698cf1c.tar.gz
First iteration to allow creating QA resources using the API
Diffstat (limited to 'qa/spec/runtime/env_spec.rb')
-rw-r--r--qa/spec/runtime/env_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index fda955f6600..b5ecf1afb80 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -34,6 +34,10 @@ describe QA::Runtime::Env do
end
end
+ describe '.verbose?' do
+ it_behaves_like 'boolean method', :verbose?, 'VERBOSE', false
+ end
+
describe '.signup_disabled?' do
it_behaves_like 'boolean method', :signup_disabled?, 'SIGNUP_DISABLED', false
end
@@ -64,7 +68,54 @@ describe QA::Runtime::Env do
end
end
+ describe '.personal_access_token' do
+ around do |example|
+ described_class.instance_variable_set(:@personal_access_token, nil)
+ example.run
+ described_class.instance_variable_set(:@personal_access_token, nil)
+ end
+
+ context 'when PERSONAL_ACCESS_TOKEN is set' do
+ before do
+ stub_env('PERSONAL_ACCESS_TOKEN', 'a_token')
+ end
+
+ it 'returns specified token from env' do
+ expect(described_class.personal_access_token).to eq 'a_token'
+ end
+ end
+
+ context 'when @personal_access_token is set' do
+ before do
+ described_class.personal_access_token = 'another_token'
+ end
+
+ it 'returns the instance variable value' do
+ expect(described_class.personal_access_token).to eq 'another_token'
+ end
+ end
+ end
+
+ describe '.personal_access_token=' do
+ around do |example|
+ described_class.instance_variable_set(:@personal_access_token, nil)
+ example.run
+ described_class.instance_variable_set(:@personal_access_token, nil)
+ end
+
+ it 'saves the token' do
+ described_class.personal_access_token = 'a_token'
+
+ expect(described_class.personal_access_token).to eq 'a_token'
+ end
+ end
+
describe '.forker?' do
+ before do
+ stub_env('GITLAB_FORKER_USERNAME', nil)
+ stub_env('GITLAB_FORKER_PASSWORD', nil)
+ end
+
it 'returns false if no forker credentials are defined' do
expect(described_class).not_to be_forker
end