Skip to content

Commit

Permalink
Merge pull request resque#18 from toddthomas/fix_respond_to
Browse files Browse the repository at this point in the history
Fix respond_to? so Resque.redis= works again.
  • Loading branch information
defunkt committed May 16, 2011
2 parents d45c762 + 90a6eb8 commit ffb9c72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/redis/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,14 @@ def type(key)
method_missing(:type, key)
end

alias_method :self_respond_to?, :respond_to?

def respond_to?(command)
@redis.respond_to?(command)
if self_respond_to?(command)
true
else
@redis.respond_to?(command)
end
end

def keys(query = nil)
Expand Down
4 changes: 4 additions & 0 deletions spec/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@
@namespaced['foo'].should == 'chris'
end

it "should respond to :namespace=" do
@namespaced.respond_to?(:namespace=).should == true
end

# Only test aliasing functionality for Redis clients that support aliases.
unless Redis::Namespace::ALIASES.empty?
it "should support command aliases (delete)" do
Expand Down

0 comments on commit ffb9c72

Please sign in to comment.