From 2ad990bba0cce86bd2e44d2e91e73f874f0f0896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 18 Jun 2018 17:05:42 +0200 Subject: [QA] Add a new scenario to test GitHub import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- qa/spec/runtime/env_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'qa/spec') diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index 2b6365dbc41..851026c71f0 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -76,4 +76,27 @@ describe QA::Runtime::Env do expect { described_class.user_type }.to raise_error(ArgumentError) end end + + describe '.github_access_token' do + it 'returns "" if GITHUB_ACCESS_TOKEN is not defined' do + expect(described_class.github_access_token).to eq('') + end + + it 'returns stripped string if GITHUB_ACCESS_TOKEN is defined' do + stub_env('GITHUB_ACCESS_TOKEN', ' abc123 ') + expect(described_class.github_access_token).to eq('abc123') + end + end + + describe '.require_github_access_token!' do + it 'raises ArgumentError if GITHUB_ACCESS_TOKEN is not defined' do + expect { described_class.require_github_access_token! }.to raise_error(ArgumentError) + end + + it 'does not raise if GITHUB_ACCESS_TOKEN is defined' do + stub_env('GITHUB_ACCESS_TOKEN', ' abc123 ') + + expect { described_class.require_github_access_token! }.not_to raise_error + end + end end -- cgit v1.2.1