Skip to content

Commit

Permalink
Adding a spec and a fix for the nil options
Browse files Browse the repository at this point in the history
  • Loading branch information
KensoDev committed Mar 28, 2012
1 parent e9607e4 commit e14c5c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_support/cache/dalli_store_additions.rb
Expand Up @@ -12,7 +12,7 @@ module Cache
class DalliStore < Store
def write_with_tags(key, value, options = {})
ActiveSupport::Notifications.instrument("cashier.write_cache_key", :data => key) do
tags = options.delete(:tag)
tags = (options.nil?) ? options : options.delete(:tag)
Cashier.store_fragment(key, tags) if tags

write_without_tags(key, value, options)
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/active_support/cache/dalli_store_additions_spec.rb
Expand Up @@ -15,6 +15,10 @@
cashier.should_not_receive(:store_fragment)
subject.write("foo", "bar")
end

it "should not fail when I don't pass in any options" do
expect { subject.write("foo", "bar", nil) }.to_not raise_error
end
end

context "fetch" do
Expand Down

0 comments on commit e14c5c2

Please sign in to comment.