Commit a57993ff authored by Luke Duncalfe's avatar Luke Duncalfe

Combine ObjectStorage spec contexts

`uploaders/object_storage_spec.rb` previously had two `context` blocks
on the same tree level that are both labelled 'when local file is used':

https://gitlab.com/gitlab-org/gitlab/-/blob/44002f46888a5944c710a04a016f6fa3ef45e466/spec/uploaders/object_storage_spec.rb#L599
https://gitlab.com/gitlab-org/gitlab/-/blob/44002f46888a5944c710a04a016f6fa3ef45e466/spec/uploaders/object_storage_spec.rb#L615

After asking in this issue:

https://gitlab.com/gitlab-org/gitlab/-/issues/209967

The decision was to combine them.
parent eb3c3162
...@@ -596,22 +596,6 @@ describe ObjectStorage do ...@@ -596,22 +596,6 @@ describe ObjectStorage do
uploader.cache!(uploaded_file) uploader.cache!(uploaded_file)
end end
context 'when local file is used' do
context 'when valid file is used' do
let(:uploaded_file) do
fixture_file_upload('spec/fixtures/rails_sample.jpg', 'image/jpg')
end
it "properly caches the file" do
subject
expect(uploader).to be_exists
expect(uploader.path).to start_with(uploader_class.root)
expect(uploader.filename).to eq('rails_sample.jpg')
end
end
end
context 'when local file is used' do context 'when local file is used' do
let(:temp_file) { Tempfile.new("test") } let(:temp_file) { Tempfile.new("test") }
...@@ -627,6 +611,14 @@ describe ObjectStorage do ...@@ -627,6 +611,14 @@ describe ObjectStorage do
context 'when valid file is specified' do context 'when valid file is specified' do
let(:uploaded_file) { temp_file } let(:uploaded_file) { temp_file }
it 'properly caches the file' do
subject
expect(uploader).to be_exists
expect(uploader.path).to start_with(uploader_class.root)
expect(uploader.filename).to eq(File.basename(uploaded_file.path))
end
context 'when object storage and direct upload is specified' do context 'when object storage and direct upload is specified' do
before do before do
stub_uploads_object_storage(uploader_class, enabled: true, direct_upload: true) stub_uploads_object_storage(uploader_class, enabled: true, direct_upload: true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment