Skip to content

Instantly share code, notes, and snippets.

@debbbbie
Last active December 29, 2015 10:19
Show Gist options
  • Save debbbbie/7656037 to your computer and use it in GitHub Desktop.
Save debbbbie/7656037 to your computer and use it in GitHub Desktop.
Add a test: every redis commands should be realized in redis-namespace
it "every redis commands should be realized in redis-namespace" do
# Use methods.map{|m|m.to_sym} for backward compatible till ruby1.8
r_methods = (Redis.public_instance_methods(false) - MonitorMixin.public_instance_methods).map{|m|m.to_sym} -
[:client, :synchronize, :with_reconnect, :without_reconnect, :connected?, :id, :method_missing, :inspect, :_bpop, :_eval, :_scan ]
rns_methods = (Redis::Namespace::COMMANDS.keys + Redis::Namespace.public_instance_methods(false)).map{|m|m.to_sym}
do_not_needs = [:slowlog, :sync, :time, :migrate, :subscribed?, :unwatch, :script]
(r_methods - rns_methods - do_not_needs).should eq([])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment