Clean up timeout and add tests.

This commit is contained in:
Dylan Egan 2011-07-12 13:05:54 +10:00
parent b3744d8940
commit 47ca2bc45a
2 changed files with 17 additions and 10 deletions

View File

@ -1,13 +1,10 @@
module Fog
def self.timeout
@timeout ||= 600
end
@timeout = 600
def self.timeout
@timeout
end
def self.timeout=(new_timeout)
raise ArgumentError, "timeout must be non-negative" unless new_timeout >= 0
@timeout = new_timeout
end
def self.timeout=(timeout)
raise ArgumentError, "timeout must be non-negative" unless timeout >= 0
@timeout = timeout
end
end

View File

@ -0,0 +1,10 @@
Shindo.tests('Fog#timeout', 'core') do
tests('timeout').returns(600) do
Fog.timeout
end
tests('timeout = 300').returns(300) do
Fog.timeout = 300
Fog.timeout
end
end