Improve specs for hiding runners tokens in traces

This commit is contained in:
Grzegorz Bizon 2018-11-20 15:41:06 +01:00
parent 747a5c425a
commit 0a611caaf9
2 changed files with 6 additions and 26 deletions

View file

@ -769,33 +769,15 @@ describe Ci::Build do
let(:subject) { build.hide_secrets(data) }
context 'hide runners token' do
let(:data) { 'new token data'}
let(:data) { "new #{project.runners_token} data"}
before do
build.project.update(runners_token: 'token')
end
it { is_expected.to eq('new xxxxx data') }
it { is_expected.to match(/^new [x]+ data$/) }
end
context 'hide build token' do
let(:data) { 'new token data'}
let(:data) { "new #{build.token} data"}
before do
build.update(token: 'token')
end
it { is_expected.to eq('new xxxxx data') }
end
context 'hide build token' do
let(:data) { 'new token data'}
before do
build.update(token: 'token')
end
it { is_expected.to eq('new xxxxx data') }
it { is_expected.to match(/^new [x]+ data$/) }
end
end

View file

@ -180,10 +180,9 @@ shared_examples_for 'common trace features' do
end
context 'runners token' do
let(:token) { 'my_secret_token' }
let(:token) { build.project.runners_token }
before do
build.project.update(runners_token: token)
trace.set(token)
end
@ -193,10 +192,9 @@ shared_examples_for 'common trace features' do
end
context 'hides build token' do
let(:token) { 'my_secret_token' }
let(:token) { build.token }
before do
build.update(token: token)
trace.set(token)
end