expire will set in_use to false

This commit is contained in:
Aaron Patterson
2011-11-29 13:19:58 -08:00
parent 79306de791
commit f866f66b30
2 changed files with 12 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ module ActiveRecord
@visitor = nil
@schema_cache = SchemaCache.new self
@in_use = false
@last_use = false
end
def lease
@@ -80,6 +81,10 @@ module ActiveRecord
end
end
def expire
@in_use = false
end
# Returns the human-readable name of the adapter. Use mixed case - one
# can always use downcase if needed.
def adapter_name

View File

@@ -26,6 +26,13 @@ module ActiveRecord
adapter.lease
assert adapter.last_use
end
def test_expire_mutates_in_use
assert adapter.lease, 'lease adapter'
assert adapter.in_use?, 'adapter is in use'
adapter.expire
assert !adapter.in_use?, 'adapter is in use'
end
end
end
end