Permalink
Browse files

Implement a `NullObject` to replace the live Redis.

  • Loading branch information...
1 parent 76596de commit 844f35577b01e7fe98d1544cd39f7f2aaef7c4ce @leehambley leehambley committed Mar 2, 2012
Showing with 13 additions and 3 deletions.
  1. +13 −3 spec/spec_helper.rb
View
@@ -1,14 +1,11 @@
require 'rubygems'
require 'active_record'
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../..', 'lib'))
-
require 'likeable'
-
def build_user!
eval %Q{
class User
@@ -45,6 +42,19 @@ def default_adapter!
build_user!
+class NullRedis < BasicObject
+
+ def method_missing(*args)
+ self
+ end
+
+ def to_s
+ "Null Redis"
+ end
+
+end
+
+Likeable.redis = NullRedis.new
require 'tempfile'
require 'rspec'

0 comments on commit 844f355

Please sign in to comment.