From 5b2678841e4df4c3e0bdd0ffe5d09a392b51d987 Mon Sep 17 00:00:00 2001 From: Nate Wiger Date: Mon, 16 Sep 2013 10:38:36 -0700 Subject: [PATCH] Fix problematic typo in fill [johnmaxwell] --- lib/redis/hash_key.rb | 2 +- spec/redis_objects_instance_spec.rb | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/redis/hash_key.rb b/lib/redis/hash_key.rb index a45408c..8b6679d 100644 --- a/lib/redis/hash_key.rb +++ b/lib/redis/hash_key.rb @@ -118,7 +118,7 @@ def bulk_set(*args) # Set keys in bulk if they do not exist. Takes a hash of field/values {'field1' => 'val1'}. Redis: HSETNX def fill(pairs={}) - raise ArgumentErorr, "Arugment to fill must be a hash of key/value pairs" unless pairs.is_a?(::Hash) + raise ArgumentError, "Arugment to fill must be a hash of key/value pairs" unless pairs.is_a?(::Hash) pairs.each do |field, value| redis.hsetnx(key, field, to_redis(value, options[:marshal_keys][field])) end diff --git a/spec/redis_objects_instance_spec.rb b/spec/redis_objects_instance_spec.rb index be37953..a010335 100644 --- a/spec/redis_objects_instance_spec.rb +++ b/spec/redis_objects_instance_spec.rb @@ -585,13 +585,15 @@ @hash['foo'].should == 'bar' @hash['abc'].should == '123' @hash['bang'].should == 'michael' + + it "raises an error if a non-Hash is passed to fill" do + lambda { @hash.fill([]) }.should.raise(ArgumentError) + end end - after do @hash.clear end - end describe Redis::Set do @@ -758,7 +760,6 @@ @set_1.clear @set_2.clear @set_3.clear - end end