Permalink
Browse files

Missed a MASSIVE set of failures in the sadd spec the first time

arround. This corrals the dump call to arrays hashes and strings
  • Loading branch information...
kungfumike committed Mar 14, 2013
1 parent c19d634 commit 15d8f446926b7cd58487063fde95222aec51bd6f
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/mock_redis/utility_methods.rb
@@ -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)

0 comments on commit 15d8f44

Please sign in to comment.