Skip to content

Commit

Permalink
expire will set in_use to false
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Nov 29, 2011
1 parent 79306de commit f866f66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Expand Up @@ -69,6 +69,7 @@ def initialize(connection, logger = nil) #:nodoc:
@visitor = nil
@schema_cache = SchemaCache.new self
@in_use = false
@last_use = false
end

def lease
Expand All @@ -80,6 +81,10 @@ def lease
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
Expand Down
Expand Up @@ -26,6 +26,13 @@ def test_last_use
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

0 comments on commit f866f66

Please sign in to comment.