Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lrucache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(opts={})
@ttl = Float(opts[:ttl] || 0)
@soft_ttl = Float(opts[:soft_ttl] || 0)
@retry_delay = Float(opts[:retry_delay] || 0)
raise "max_size must not be negative" if @max_size < 0
raise "max_size must be greater than 0" if @max_size < 1
raise "ttl must not be negative" if @ttl < 0
raise "soft_ttl must not be negative" if @soft_ttl < 0
raise "retry_delay must not be negative" if @retry_delay < 0
Expand Down
3 changes: 2 additions & 1 deletion spec/lrucache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
it "should raise an exception if :max_size parameter can't be converted to an integer" do
expect { LRUCache.new(:max_size => "moocow") }.to raise_exception
end
it "should raise an exception if :max_size parameter is converted to a negative integer" do
it "should raise an exception if :max_size parameter is converted to a non-positive integer" do
expect { LRUCache.new(:max_size => -1) }.to raise_exception
expect { LRUCache.new(:max_size => 0) }.to raise_exception
end

it "should default :default to nil" do
Expand Down