remove uninitialised variable warnings
This commit is contained in:
parent
da12d6134a
commit
f27a8d6837
|
@ -28,7 +28,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || super
|
@db ||= super
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_config
|
def load_config
|
||||||
|
@ -39,8 +39,8 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def connection_class
|
def connection_class
|
||||||
@connection_class ||= if @db && !@db.is_a?(Symbol)
|
@connection_class ||= if db && !db.is_a?(Symbol)
|
||||||
@db
|
db
|
||||||
elsif connection_hash
|
elsif connection_hash
|
||||||
lookup_from_connection_pool || establish_connection
|
lookup_from_connection_pool || establish_connection
|
||||||
else
|
else
|
||||||
|
|
|
@ -25,7 +25,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || :default
|
@db ||= :default
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_strategy(*args)
|
def create_strategy(*args)
|
||||||
|
@ -67,7 +67,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def strategy
|
def strategy
|
||||||
@strategy || NullStrategy
|
@strategy ||= NullStrategy
|
||||||
end
|
end
|
||||||
|
|
||||||
def orm=(desired_orm)
|
def orm=(desired_orm)
|
||||||
|
|
|
@ -37,7 +37,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def app_root
|
def app_root
|
||||||
@app_root || Dir.pwd
|
@app_root ||= Dir.pwd
|
||||||
end
|
end
|
||||||
|
|
||||||
def connections
|
def connections
|
||||||
|
|
|
@ -13,7 +13,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || :default
|
@db ||= :default
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || :default
|
@db ||= :default
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || :default
|
@db ||= :default
|
||||||
end
|
end
|
||||||
|
|
||||||
def host_port=(desired_host)
|
def host_port=(desired_host)
|
||||||
|
@ -22,7 +22,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def host
|
def host
|
||||||
@host || '127.0.0.1:27017'
|
@host ||= '127.0.0.1:27017'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -14,7 +14,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
def db
|
def db
|
||||||
@db || :default
|
@db ||= :default
|
||||||
end
|
end
|
||||||
|
|
||||||
alias url db
|
alias url db
|
||||||
|
|
|
@ -8,7 +8,7 @@ module DatabaseCleaner
|
||||||
|
|
||||||
describe Truncation do
|
describe Truncation do
|
||||||
let(:args) {{}}
|
let(:args) {{}}
|
||||||
let(:truncation) { described_class.new(args).tap { |t| t.db=@db } }
|
let(:truncation) { described_class.new(args) }
|
||||||
#doing this in the file root breaks autospec, doing it before(:all) just fails the specs
|
#doing this in the file root breaks autospec, doing it before(:all) just fails the specs
|
||||||
before(:all) do
|
before(:all) do
|
||||||
@test_db = 'database_cleaner_specs'
|
@test_db = 'database_cleaner_specs'
|
||||||
|
|
Loading…
Reference in New Issue