Skip to content

Commit

Permalink
Remove #reload on the model with uploader from specs
Browse files Browse the repository at this point in the history
  • Loading branch information
y9v committed Oct 22, 2018
1 parent 3ea6e16 commit ab8fdf1
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions spec/adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

it 'creates a file' do
subject.save!
subject.reload

expect(
subject.image.current_path
Expand Down Expand Up @@ -86,7 +85,6 @@

it 'saves the file' do
subject.save!
subject.reload

expect(
subject.image.current_path
Expand All @@ -103,7 +101,6 @@

it 'creates a file' do
subject.save!
subject.reload

expect(
subject.image.current_path
Expand All @@ -126,7 +123,6 @@
it 'should invoke the file_name proc upon each upload' do
subject.save!
another_subject.save!
another_subject.reload
expect(
another_subject.image.current_path
).to eq file_path('../uploads', 'robin.jpeg')
Expand All @@ -140,19 +136,18 @@
file_path('fixtures', 'base64_image.fixture')
).strip
subject.save!
subject.reload
end

it 'keeps the file when setting the attribute to existing value' do
expect(File.exist?(subject.reload.image.file.file)).to be_truthy
expect(File.exist?(subject.image.file.file)).to be_truthy
subject.update!(image: subject.image.to_s)
expect(File.exist?(subject.reload.image.file.file)).to be_truthy
expect(File.exist?(subject.image.file.file)).to be_truthy
end

it 'removes files when remove_* is set to true' do
subject.remove_image = true
subject.save!
expect(subject.reload.image.file).to be_nil
expect(subject.image.file).to be_nil
end
end
end
Expand All @@ -169,7 +164,6 @@
file_path('fixtures', 'base64_image.fixture')
).strip
subject.save!
subject.reload
end

it 'gives no false positive on presence validation' do
Expand Down

0 comments on commit ab8fdf1

Please sign in to comment.