diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2017-01-09 18:19:48 +0100 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2017-01-09 18:19:48 +0100 |
commit | a8177e03e5eeade5b8af405dbb4bcd8a6d06bb0a (patch) | |
tree | 02539d1a9f940d1f21f94d4a4b530250037c404f /spec/db | |
parent | 583deef209af5a2700701fb0933582a7b5680620 (diff) | |
download | gitlab-ce-a8177e03e5eeade5b8af405dbb4bcd8a6d06bb0a.tar.gz |
Introduce "stub_env" test helper for safely stubbing environment variables
Diffstat (limited to 'spec/db')
-rw-r--r-- | spec/db/production/settings.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/db/production/settings.rb b/spec/db/production/settings.rb index a7c5283df94..007b35bbb77 100644 --- a/spec/db/production/settings.rb +++ b/spec/db/production/settings.rb @@ -2,10 +2,11 @@ require 'spec_helper' require 'rainbow/ext/string' describe 'seed production settings', lib: true do + include StubENV + context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do before do - allow(ENV).to receive(:[]).and_call_original - allow(ENV).to receive(:[]).with('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN').and_return('013456789') + stub_env('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN', '013456789') end it 'writes the token to the database' do |