From 5f7b80a6d6fed524e8b41e9e465d360ddd6b8822 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Jul 2017 21:08:36 +0200 Subject: [PATCH] Match File.exist? --- lib/active_file/site.rb | 2 +- lib/active_file/sites/disk_site.rb | 2 +- lib/active_file/sites/mirror_site.rb | 4 ++-- lib/active_file/sites/s3_site.rb | 4 ++-- test/disk_site_test.rb | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/active_file/site.rb b/lib/active_file/site.rb index 44010767dd..33494b916a 100644 --- a/lib/active_file/site.rb +++ b/lib/active_file/site.rb @@ -15,7 +15,7 @@ class ActiveFile::Site raise NotImplementedError end - def exists?(key) + def exist?(key) raise NotImplementedError end diff --git a/lib/active_file/sites/disk_site.rb b/lib/active_file/sites/disk_site.rb index d0ec14cbe1..7f151ed21b 100644 --- a/lib/active_file/sites/disk_site.rb +++ b/lib/active_file/sites/disk_site.rb @@ -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 diff --git a/lib/active_file/sites/mirror_site.rb b/lib/active_file/sites/mirror_site.rb index 86dd906be7..f734f3ebf9 100644 --- a/lib/active_file/sites/mirror_site.rb +++ b/lib/active_file/sites/mirror_site.rb @@ -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 diff --git a/lib/active_file/sites/s3_site.rb b/lib/active_file/sites/s3_site.rb index 46c409405a..838163a23d 100644 --- a/lib/active_file/sites/s3_site.rb +++ b/lib/active_file/sites/s3_site.rb @@ -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 diff --git a/test/disk_site_test.rb b/test/disk_site_test.rb index c69a02bf45..198283a97b 100644 --- a/test/disk_site_test.rb +++ b/test/disk_site_test.rb @@ -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