1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Match File.exist?

This commit is contained in:
David Heinemeier Hansson 2017-07-03 21:08:36 +02:00
parent 13193bf5ae
commit 5f7b80a6d6
5 changed files with 9 additions and 9 deletions

View file

@ -15,7 +15,7 @@ class ActiveFile::Site
raise NotImplementedError
end
def exists?(key)
def exist?(key)
raise NotImplementedError
end

View file

@ -33,7 +33,7 @@ class ActiveFile::Sites::DiskSite < ActiveFile::Site
File.delete path_for(key)
end
def exists?(key)
def exist?(key)
File.exist? path_for(key)
end

View file

@ -17,8 +17,8 @@ class ActiveFile::Sites::MirrorSite < ActiveFile::Site
perform_across_sites :delete, key
end
def exists?(key)
perform_across_sites(:exists?, key).any?
def exist?(key)
perform_across_sites(:exist?, key).any?
end

View file

@ -24,8 +24,8 @@ class ActiveFile::Sites::S3Site < ActiveFile::Site
object_for(key).delete
end
def exists?(key)
object_for(key).exists?
def exist?(key)
object_for(key).exist?
end

View file

@ -32,13 +32,13 @@ class ActiveFile::DiskSiteTest < ActiveSupport::TestCase
end
test "existing" do
assert @site.exists?(FIXTURE_KEY)
assert_not @site.exists?(FIXTURE_KEY + "nonsense")
assert @site.exist?(FIXTURE_KEY)
assert_not @site.exist?(FIXTURE_KEY + "nonsense")
end
test "deleting" do
@site.delete FIXTURE_KEY
assert_not @site.exists?(FIXTURE_KEY)
assert_not @site.exist?(FIXTURE_KEY)
end
test "sizing" do