Skip to content

Commit

Permalink
spec: Replace deprecated File.exists? with File.exist? (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtasaka committed Nov 13, 2022
1 parent 2ed9959 commit 79ac98a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/lib/mini_magick/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def create(path = image_path)

it "creates an image" do
image = create
expect(File.exists?(image.path)).to eq true
expect(File.exist?(image.path)).to eq true
end

it "validates the image if validation is set" do
Expand Down Expand Up @@ -263,12 +263,12 @@ def create(path = image_path)
cache_path = image.path.sub(/mpc$/, "cache")
image.format("png")

expect(File.exists?(cache_path)).to eq false
expect(File.exist?(cache_path)).to eq false
end

it "doesn't delete itself when formatted to the same format" do
subject.format(subject.type.downcase)
expect(File.exists?(subject.path)).to eq true
expect(File.exist?(subject.path)).to eq true
end

it "reformats multi-image formats to multiple images" do
Expand Down Expand Up @@ -731,22 +731,22 @@ def create(path = image_path)
image = described_class.open(image_path)
image.destroy!

expect(File.exists?(image.path)).to eq false
expect(File.exist?(image.path)).to eq false
end

it "doesn't delete when there is no tempfile" do
image = described_class.new(image_path)
image.destroy!

expect(File.exists?(image.path)).to eq true
expect(File.exist?(image.path)).to eq true
end

it "deletes .cache files generated by handling .mpc files" do
image = described_class.open(image_path)
image.format("mpc")
image.destroy!

expect(File.exists?(image.path.sub(/mpc$/, "cache"))).to eq false
expect(File.exist?(image.path.sub(/mpc$/, "cache"))).to eq false
end
end

Expand Down

0 comments on commit 79ac98a

Please sign in to comment.