Correct more usages of non-relative fixture_file_upload paths

This commit is contained in:
Robert Speicher 2018-06-06 16:26:00 -05:00
parent 6d165c740c
commit b38c75b3dc
8 changed files with 13 additions and 19 deletions

View file

@ -88,8 +88,7 @@ describe 'Project Jobs Permissions' do
describe 'artifacts page' do
context 'when recent job has artifacts available' do
before do
artifacts = Rails.root.join('spec/fixtures/ci_build_artifacts.zip')
archive = fixture_file_upload(artifacts, 'application/zip')
archive = fixture_file_upload('spec/fixtures/ci_build_artifacts.zip')
job.update_attributes(legacy_artifacts_file: archive)
end

View file

@ -47,9 +47,7 @@ describe EmailsHelper do
describe '#header_logo' do
context 'there is a brand item with a logo' do
it 'returns the brand header logo' do
appearance = create :appearance, header_logo: fixture_file_upload(
Rails.root.join('spec/fixtures/dk.png')
)
appearance = create :appearance, header_logo: fixture_file_upload('spec/fixtures/dk.png')
expect(header_logo).to eq(
%{<img style="height: 50px" src="/uploads/-/system/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />}

View file

@ -4,9 +4,9 @@ describe GroupsHelper do
include ApplicationHelper
describe 'group_icon' do
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
it 'returns an url for the avatar' do
avatar_file_path = File.join('spec', 'fixtures', 'banana_sample.gif')
group = create(:group)
group.avatar = fixture_file_upload(avatar_file_path)
group.save!
@ -17,9 +17,9 @@ describe GroupsHelper do
end
describe 'group_icon_url' do
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
it 'returns an url for the avatar' do
avatar_file_path = File.join('spec', 'fixtures', 'banana_sample.gif')
group = create(:group)
group.avatar = fixture_file_upload(avatar_file_path)
group.save!

View file

@ -3,7 +3,7 @@ require 'spec_helper'
describe API::ProjectImport do
let(:export_path) { "#{Dir.tmpdir}/project_export_spec" }
let(:user) { create(:user) }
let(:file) { File.join(Rails.root, 'spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
let(:file) { File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
let(:namespace) { create(:group) }
before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)

View file

@ -10,7 +10,7 @@ describe Projects::UpdatePagesService do
let(:file) { fixture_file_upload("spec/fixtures/pages.#{extension}") }
let(:empty_file) { fixture_file_upload("spec/fixtures/pages_empty.#{extension}") }
let(:metadata) do
filename = Rails.root + "spec/fixtures/pages.#{extension}.meta"
filename = "spec/fixtures/pages.#{extension}.meta"
fixture_file_upload(filename) if File.exist?(filename)
end

View file

@ -62,7 +62,7 @@ describe GitlabUploader do
expect(FileUtils).to receive(:mv).with(anything, /^#{subject.work_dir}/).and_call_original
expect(FileUtils).to receive(:mv).with(/^#{subject.work_dir}/, /#{subject.cache_dir}/).and_call_original
fixture = Rails.root.join('spec', 'fixtures', 'rails_sample.jpg')
fixture = File.join('spec', 'fixtures', 'rails_sample.jpg')
subject.cache!(fixture_file_upload(fixture))
expect(subject.file.path).to match(/#{subject.cache_dir}/)

View file

@ -29,8 +29,7 @@ describe JobArtifactUploader do
context 'when trace is stored in File storage' do
context 'when file exists' do
let(:file) do
fixture_file_upload(
Rails.root.join('spec/fixtures/trace/sample_trace'), 'text/plain')
fixture_file_upload('spec/fixtures/trace/sample_trace', 'text/plain')
end
before do
@ -63,8 +62,7 @@ describe JobArtifactUploader do
context 'file is stored in valid local_path' do
let(:file) do
fixture_file_upload(
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip')
fixture_file_upload('spec/fixtures/ci_build_artifacts.zip', 'application/zip')
end
before do
@ -81,7 +79,7 @@ describe JobArtifactUploader do
describe "#migrate!" do
before do
uploader.store!(fixture_file_upload(File.join('spec/fixtures/trace/sample_trace')))
uploader.store!(fixture_file_upload('spec/fixtures/trace/sample_trace'))
stub_artifacts_object_storage
end

View file

@ -44,8 +44,7 @@ describe LegacyArtifactUploader do
context 'file is stored in valid path' do
let(:file) do
fixture_file_upload(
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip')
fixture_file_upload('spec/fixtures/ci_build_artifacts.zip', 'application/zip')
end
before do