diff options
author | Rémy Coutable <remy@rymai.me> | 2018-10-17 18:08:20 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-17 18:08:20 +0000 |
commit | b6f2f738c73b1dfe66be61e1b37ca21fa698cf1c (patch) | |
tree | b6b520d12c2051a6a1cdaa5741f48f6583e0cce8 /qa/spec/runtime/api/client_spec.rb | |
parent | ab9cf561c230f1b6ec630215a9a9def53e14d764 (diff) | |
download | gitlab-ce-b6f2f738c73b1dfe66be61e1b37ca21fa698cf1c.tar.gz |
First iteration to allow creating QA resources using the API
Diffstat (limited to 'qa/spec/runtime/api/client_spec.rb')
-rw-r--r-- | qa/spec/runtime/api/client_spec.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/qa/spec/runtime/api/client_spec.rb b/qa/spec/runtime/api/client_spec.rb index d497d8839b8..975586b505f 100644 --- a/qa/spec/runtime/api/client_spec.rb +++ b/qa/spec/runtime/api/client_spec.rb @@ -13,18 +13,27 @@ describe QA::Runtime::API::Client do end end - describe '#get_personal_access_token' do - it 'returns specified token from env' do - stub_env('PERSONAL_ACCESS_TOKEN', 'a_token') + describe '#personal_access_token' do + context 'when QA::Runtime::Env.personal_access_token is present' do + before do + allow(QA::Runtime::Env).to receive(:personal_access_token).and_return('a_token') + end - expect(described_class.new.get_personal_access_token).to eq 'a_token' + it 'returns specified token from env' do + expect(described_class.new.personal_access_token).to eq 'a_token' + end end - it 'returns a created token' do - allow_any_instance_of(described_class) - .to receive(:create_personal_access_token).and_return('created_token') + context 'when QA::Runtime::Env.personal_access_token is nil' do + before do + allow(QA::Runtime::Env).to receive(:personal_access_token).and_return(nil) + end - expect(described_class.new.get_personal_access_token).to eq 'created_token' + it 'returns a created token' do + expect(subject).to receive(:create_personal_access_token).and_return('created_token') + + expect(subject.personal_access_token).to eq 'created_token' + end end end end |