tdiary/tdiary-cache-redis — pull request #1 by minimum2scp (2014-10-28 15:50:39+00:00)
Title: Fixed argument for Redis::Namespace.new (to work with redis-namespace v1.5.1)

redis-namespace v1.5.1 では spec が以下のように落ちていたので、修正しました。

```
% bundle exec rake spec
/usr/bin/ruby2.1 -I/home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.1.7/lib:/home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-support-3.1.2/lib /home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

TDiary::Cache
TDiaryBase
example at ./spec/tdiary/cache/redis_spec.rb:12
TDiaryMonth
example at ./spec/tdiary/cache/redis_spec.rb:23 (FAILED - 1)
TDiaryMonth
given params
example at ./spec/tdiary/cache/redis_spec.rb:38
not given params
example at ./spec/tdiary/cache/redis_spec.rb:46 (FAILED - 2)

Failures:

1) TDiary::Cache TDiaryMonth
Failure/Error: @cache.store_cache(:foo, "foo")
Redis::CommandError:
ERR unknown command 'fetch'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:103:in `call'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:2486:in `block in method_missing'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `block in synchronize'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `synchronize'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:2485:in `method_missing'
# ./vendor/bundle/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:219:in `initialize'
# ./lib/tdiary/cache/redis.rb:86:in `new'
# ./lib/tdiary/cache/redis.rb:86:in `redis'
# ./lib/tdiary/cache/redis.rb:42:in `store_data'
# ./lib/tdiary/cache/redis.rb:15:in `store_cache'
# ./spec/tdiary/cache/redis_spec.rb:20:in `block (3 levels) in '

2) TDiary::Cache TDiaryMonth not given params
Failure/Error: @cache.store_cache(:foo, "foo")
Redis::CommandError:
ERR unknown command 'fetch'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:103:in `call'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:2486:in `block in method_missing'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `block in synchronize'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `synchronize'
# ./vendor/bundle/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:2485:in `method_missing'
# ./vendor/bundle/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:219:in `initialize'
# ./lib/tdiary/cache/redis.rb:86:in `new'
# ./lib/tdiary/cache/redis.rb:86:in `redis'
# ./lib/tdiary/cache/redis.rb:42:in `store_data'
# ./lib/tdiary/cache/redis.rb:15:in `store_cache'
# ./spec/tdiary/cache/redis_spec.rb:44:in `block (4 levels) in '

Deprecation Warnings:

Using `should_not_receive` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead. Called from /home/debian/go/src/github.com/tdiary/tdiary-cache-redis/spec/tdiary/cache/redis_spec.rb:9:in `block (3 levels) in '.

If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
`config.raise_errors_for_deprecations!`, and it will turn the
deprecation warnings into errors, giving you the full backtrace.

1 deprecation warning total

Finished in 0.00252 seconds (files took 0.12133 seconds to load)
4 examples, 2 failures

Failed examples:

rspec ./spec/tdiary/cache/redis_spec.rb:23 # TDiary::Cache TDiaryMonth
rspec ./spec/tdiary/cache/redis_spec.rb:46 # TDiary::Cache TDiaryMonth not given params
/usr/bin/ruby2.1 -I/home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.1.7/lib:/home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-support-3.1.2/lib /home/debian/go/src/github.com/tdiary/tdiary-cache-redis/vendor/bundle/ruby/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
```

redis-namespace v1.4.1 まででは落ちないのですが、v1.5.0 と v1.5.1 で落ちるようになっていました。
おそらく https://github.com/resque/redis-namespace/commit/0ff09bae9ab52b6a3c623d136b326206b08362a3 で落ちるようになったのだと思いますが、
tdiary-cache-redis が Redis::Namespace.new に渡す引数を間違えていたのが原因です。
(redis-namespace v1.4.1までは、たまたま動いていただけ)

redis-namespace v1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.5.0, 1.5.1 で spec が通ることを確認しました。