Skip to content

Commit

Permalink
Missed a MASSIVE set of failures in the sadd spec the first time
Browse files Browse the repository at this point in the history
arround. This corrals the dump call to arrays hashes and strings
  • Loading branch information
kungfumike committed Mar 14, 2013
1 parent c19d634 commit 15d8f44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mock_redis/utility_methods.rb
Expand Up @@ -9,12 +9,16 @@ def with_thing_at(key, assertion, empty_thing_generator)
data_key_ref = data[key]
ret = yield data[key]
data[key] = data_key_ref if data[key].nil?
ret ? ret.dup : ret
primitive?(ret) ? ret.dup : ret
ensure
clean_up_empties_at(key)
end
end

def primitive?(value)
value.kind_of?(::Array) || value.kind_of?(::Hash) ||value.kind_of?(::String)
end

def clean_up_empties_at(key)
if data[key] && data[key].empty?
del(key)
Expand Down

0 comments on commit 15d8f44

Please sign in to comment.