Skip to content

Commit

Permalink
File.exists? had been deprecated since Ruby 2.1 and has been deleted …
Browse files Browse the repository at this point in the history
…in Ruby 3.2
  • Loading branch information
amatsuda authored and mshibuya committed Jan 8, 2023
1 parent ed8c518 commit bdb0be0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/storage/fog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class FogSpec#{fog_credentials[:provider]}Uploader < CarrierWave::Uploader::Base
it "should create local file for processing" do
@uploader.class_eval do
def check_file
raise unless File.exists?(file.path)
raise unless File.exist?(file.path)
end
process :check_file
end
Expand Down
12 changes: 6 additions & 6 deletions spec/uploader/versions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def upcase
@uploader.store!(bork_file)
FileUtils.rm([@uploader.small_thumb.path, @uploader.thumb.path])
@uploader.recreate_versions!(:small_thumb)
expect(File.exists?(public_path(@uploader.thumb.to_s))).to be true
expect(File.exist?(public_path(@uploader.thumb.to_s))).to be true
expect(small_thumb_contents).to eq(thumb_contents)
expect(small_thumb_contents).not_to eq(original_contents)
end
Expand All @@ -675,22 +675,22 @@ def upcase
@uploader.store!(bork_file)
FileUtils.rm([@uploader.small_thumb.path, @uploader.thumb.path])
@uploader.recreate_versions!(:small_thumb, :thumb)
expect(File.exists?(public_path(@uploader.small_thumb.to_s))).to be true
expect(File.exists?(public_path(@uploader.thumb.to_s))).to be true
expect(File.exist?(public_path(@uploader.small_thumb.to_s))).to be true
expect(File.exist?(public_path(@uploader.thumb.to_s))).to be true

# doesn't depend on arguments order
FileUtils.rm([@uploader.small_thumb.path, @uploader.thumb.path])
@uploader.recreate_versions!(:thumb, :small_thumb)
expect(File.exists?(public_path(@uploader.small_thumb.to_s))).to be true
expect(File.exists?(public_path(@uploader.thumb.to_s))).to be true
expect(File.exist?(public_path(@uploader.small_thumb.to_s))).to be true
expect(File.exist?(public_path(@uploader.thumb.to_s))).to be true
end

it "doesn't touch other versions" do
@uploader_class.version(:another)
@uploader.store!(bork_file)
FileUtils.rm(@uploader.another.path)
@uploader.recreate_versions!(:small_thumb)
expect(File.exists?(public_path(@uploader.another.to_s))).to be false
expect(File.exist?(public_path(@uploader.another.to_s))).to be false
end
end
end
Expand Down

0 comments on commit bdb0be0

Please sign in to comment.