diff --git a/Rakefile b/Rakefile index df67edc6..59c589eb 100644 --- a/Rakefile +++ b/Rakefile @@ -40,8 +40,8 @@ namespace :db do apartment_db_file = 'spec/config/database.yml' rails_db_file = 'spec/dummy/config/database.yml' - FileUtils.copy(apartment_db_file + '.sample', apartment_db_file, :verbose => true) unless File.exists?(apartment_db_file) - FileUtils.copy(rails_db_file + '.sample', rails_db_file, :verbose => true) unless File.exists?(rails_db_file) + FileUtils.copy(apartment_db_file + '.sample', apartment_db_file, :verbose => true) unless File.exist?(apartment_db_file) + FileUtils.copy(rails_db_file + '.sample', rails_db_file, :verbose => true) unless File.exist?(rails_db_file) end end diff --git a/apartment.gemspec b/apartment.gemspec index eb59070f..73f7854c 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.licenses = ["MIT"] # must be >= 3.1.2 due to bug in prepared_statements - s.add_dependency 'activerecord', '>= 3.1.2', '< 6.1' + s.add_dependency 'activerecord', '>= 3.1.2', '<= 6.1.7.6' s.add_dependency 'rack', '>= 1.3.6' s.add_dependency 'public_suffix', '>= 2' s.add_dependency 'parallel', '>= 0.7.1' diff --git a/lib/apartment/adapters/abstract_adapter.rb b/lib/apartment/adapters/abstract_adapter.rb index 78b844b9..c7e2f0d0 100644 --- a/lib/apartment/adapters/abstract_adapter.rb +++ b/lib/apartment/adapters/abstract_adapter.rb @@ -209,7 +209,7 @@ def multi_tenantify_with_tenant_db_name(config, tenant) # Load a file or raise error if it doesn't exists # def load_or_raise(file) - if File.exists?(file) + if File.exist?(file) load(file) else raise FileNotFound, "#{file} doesn't exist yet" diff --git a/lib/apartment/adapters/sqlite3_adapter.rb b/lib/apartment/adapters/sqlite3_adapter.rb index dff5a21b..eb0469b0 100644 --- a/lib/apartment/adapters/sqlite3_adapter.rb +++ b/lib/apartment/adapters/sqlite3_adapter.rb @@ -17,7 +17,7 @@ def initialize(config) def drop(tenant) raise TenantNotFound, - "The tenant #{environmentify(tenant)} cannot be found." unless File.exists?(database_file(tenant)) + "The tenant #{environmentify(tenant)} cannot be found." unless File.exist?(database_file(tenant)) File.delete(database_file(tenant)) end @@ -30,14 +30,14 @@ def current def connect_to_new(tenant) raise TenantNotFound, - "The tenant #{environmentify(tenant)} cannot be found." unless File.exists?(database_file(tenant)) + "The tenant #{environmentify(tenant)} cannot be found." unless File.exist?(database_file(tenant)) super database_file(tenant) end def create_tenant(tenant) raise TenantExists, - "The tenant #{environmentify(tenant)} already exists." if File.exists?(database_file(tenant)) + "The tenant #{environmentify(tenant)} already exists." if File.exist?(database_file(tenant)) begin f = File.new(database_file(tenant), File::CREAT) diff --git a/spec/adapters/sqlite3_adapter_spec.rb b/spec/adapters/sqlite3_adapter_spec.rb index 55004952..fcb6198b 100644 --- a/spec/adapters/sqlite3_adapter_spec.rb +++ b/spec/adapters/sqlite3_adapter_spec.rb @@ -40,7 +40,7 @@ def tenant_names it "should create a new database" do subject.create db_name - expect(File.exists?("#{default_dir}/#{Rails.env}_#{db_name}.sqlite3")).to eq true + expect(File.exist?("#{default_dir}/#{Rails.env}_#{db_name}.sqlite3")).to eq true end end @@ -55,7 +55,7 @@ def tenant_names it "should create a new database" do subject.create db_name - expect(File.exists?("#{default_dir}/#{db_name}.sqlite3")).to eq true + expect(File.exist?("#{default_dir}/#{db_name}.sqlite3")).to eq true end end @@ -73,7 +73,7 @@ def tenant_names it "should create a new database" do subject.create db_name - expect(File.exists?("#{default_dir}/#{db_name}_#{Rails.env}.sqlite3")).to eq true + expect(File.exist?("#{default_dir}/#{db_name}_#{Rails.env}.sqlite3")).to eq true end end