From 4b9f76cede975106e1e34af787e46720e3c3bb2e Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Wed, 6 Jul 2016 15:45:43 +0800 Subject: Fix one of the failing tests. Test against the headers --- features/steps/project/builds/artifacts.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'features/steps/project/builds/artifacts.rb') diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index 2876e8812e9..4bc74688132 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -68,10 +68,15 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps end step 'download of a file extracted from build artifacts should start' do - # this will be accelerated by Workhorse - response_json = JSON.parse(page.body, symbolize_names: true) - expect(response_json[:archive]).to end_with('build_artifacts.zip') - expect(response_json[:entry]).to eq Base64.encode64('ci_artifacts.txt') + send_data = response_headers[Gitlab::Workhorse::SEND_DATA_HEADER] + + expect(send_data).to start_with('artifacts-entry:') + + params = JSON.parse(Base64.urlsafe_decode64(send_data[/(?<=:)(.+)/])) + + expect(params.keys).to eq(['Archive', 'Entry']) + expect(params['Archive']).to end_with('build_artifacts.zip') + expect(params['Entry']).to eq(Base64.encode64('ci_artifacts.txt')) end step 'I click a first row within build artifacts table' do -- cgit v1.2.1 From 1bfc2ed633b2086b547727acc4aa0abaaea7731f Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 11 Jul 2016 20:06:35 +0800 Subject: Just remove the prefix, feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5094#note_12987385 --- features/steps/project/builds/artifacts.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'features/steps/project/builds/artifacts.rb') diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index 4bc74688132..b4a32ed2e38 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -72,7 +72,8 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps expect(send_data).to start_with('artifacts-entry:') - params = JSON.parse(Base64.urlsafe_decode64(send_data[/(?<=:)(.+)/])) + base64_params = send_data.sub(/\Aartifacts\-entry:/, '') + params = JSON.parse(Base64.urlsafe_decode64(base64_params)) expect(params.keys).to eq(['Archive', 'Entry']) expect(params['Archive']).to end_with('build_artifacts.zip') -- cgit v1.2.1