Skip to content

Commit

Permalink
Merge 2cef1df into b8329c4
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Macreery committed Jan 24, 2016
2 parents b8329c4 + 2cef1df commit d475e7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/garner/cache/identity.rb
Expand Up @@ -11,8 +11,8 @@ def initialize(ruby_context = nil)
@key_hash = {}

# Set up options hash with defaults
@options_hash = Garner.config.global_cache_options || {}
@options_hash.merge!(expires_in: Garner.config.expires_in)
@options_hash = Garner.config.global_cache_options.dup || {}
@options_hash[:expires_in] ||= Garner.config.expires_in
end

def fetch(&block)
Expand Down
7 changes: 7 additions & 0 deletions spec/garner/cache/identity_spec.rb
Expand Up @@ -6,6 +6,13 @@
expect(subject.options_hash[:foo]).to eq 'bar'
end

it 'includes Garner.config.global_cache_options[:expires_in]' do
Garner.configure do |config|
config.global_cache_options = { expires_in: 5.minutes }
end
subject.options_hash[:expires_in].should eq 5.minutes
end

it 'includes Garner.config.expires_in' do
Garner.configure { |config| config.expires_in = 5.minutes }
expect(subject.options_hash[:expires_in]).to eq 5.minutes
Expand Down

0 comments on commit d475e7f

Please sign in to comment.