mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #416 from dylanegan/timeout_cleaner
Clean up timeout and add tests.
This commit is contained in:
commit
5ceabd61f2
2 changed files with 17 additions and 10 deletions
|
@ -1,13 +1,10 @@
|
||||||
module Fog
|
module Fog
|
||||||
|
def self.timeout
|
||||||
|
@timeout ||= 600
|
||||||
|
end
|
||||||
|
|
||||||
@timeout = 600
|
def self.timeout=(timeout)
|
||||||
def self.timeout
|
raise ArgumentError, "timeout must be non-negative" unless timeout >= 0
|
||||||
@timeout
|
@timeout = timeout
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.timeout=(new_timeout)
|
|
||||||
raise ArgumentError, "timeout must be non-negative" unless new_timeout >= 0
|
|
||||||
@timeout = new_timeout
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
10
tests/core/timeout_tests.rb
Normal file
10
tests/core/timeout_tests.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue