tdiary-cache-redis 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c3e3f5cef4befe0f97d4abcf045047de4f7b9df
4
- data.tar.gz: c7195b49ddce539fdad60fb66f9373ef480d8a77
3
+ metadata.gz: 2af394ab6aa0656ec712df5f0ff74ad2f75c7de7
4
+ data.tar.gz: 22ee753d01f384cb77ae5e14bdfcf5237f0a9fe3
5
5
  SHA512:
6
- metadata.gz: 5cfe70d4e473f09c59c8bed4f3896210a251bd14e70ccf050d599d04ee9b427e60c04235e66a4369ebe9ca1851ea8c3b76c56c6fca21aeda8730769358c89040
7
- data.tar.gz: 92cd34421c0e0bace8d763cc840dd6a17b0e1c6a58826eb00f475e299e0574ab09d0925716ef67e684e89b7358fba9ad08983b100e9632d54db6ec4bf06d1185
6
+ metadata.gz: 08a64d5a66529e9c95ca597cd9c2cc3abced6946946007ddf0c6249a6727b2b98e3a4860c747684db7a881389bd5351ecf574dd2f156fd3dff6bb60ebcb0a9c7
7
+ data.tar.gz: d25c8520f050f03b23be120d615d188e6c5b6300e6153df86181596e0064becd10144144458424c7e02e37cd10715b59909ed777f37ae570c41d4d612998acd2
@@ -1,3 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.0
3
+ - 2.0.0
4
+ - 1.9.3
5
+ script: bundle exec rake spec
6
+ services:
7
+ - redis-server
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Tdiary::Cache::Redis
1
+ # TDiary::Cache::Redis
2
2
 
3
- TODO: Write a gem description
3
+ redis adapter for tDiary cache
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,10 +16,6 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install tdiary-cache-redis
18
18
 
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
19
  ## Contributing
24
20
 
25
21
  1. Fork it
@@ -83,7 +83,7 @@ module TDiary
83
83
 
84
84
  def redis
85
85
  @_client ||= if @tdiary.conf.user_name
86
- Redis::Namespace.new(@tdiary.conf.user_name.to_sym, Redis.new)
86
+ Redis::Namespace.new(@tdiary.conf.user_name.to_sym, redis: Redis.new)
87
87
  else
88
88
  Redis.new
89
89
  end
@@ -1,2 +1,37 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'tdiary/cache/redis'
3
+
4
+ class DummyConf
5
+ def user_name
6
+ "foo"
7
+ end
8
+ end
9
+
10
+ class DummyCGI
11
+ attr_accessor :params
12
+ end
13
+
14
+ class DummyTDiary
15
+ attr_accessor :tdiary
16
+ end
17
+
18
+ class TDiaryBase
19
+ def conf
20
+ DummyConf.new
21
+ end
22
+
23
+ def rhtml
24
+ "foo.rhtml"
25
+ end
26
+
27
+ def cgi
28
+ @cgi ||= DummyCGI.new
29
+ end
30
+
31
+ def date
32
+ Time.now
33
+ end
34
+ end
35
+
36
+ class TDiaryMonth < TDiaryBase; end
37
+ class TDiaryLatest < TDiaryBase; end
@@ -1,11 +1,49 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Tdiary::Cache::Redis do
4
- it 'should have a version number' do
5
- Tdiary::Cache::Redis::VERSION.should_not be_nil
3
+ describe TDiary::Cache do
4
+ context "TDiaryBase" do
5
+ before do
6
+ Object.send(:include, TDiary::Cache)
7
+ @cache = Object.new
8
+
9
+ @cache.should_not_receive(:store_data)
10
+ end
11
+
12
+ it { @cache.store_cache(:foo, "foo") }
6
13
  end
7
14
 
8
- it 'should do something useful' do
9
- false.should be_true
15
+ context "TDiaryMonth" do
16
+ before do
17
+ DummyTDiary.send(:include, TDiary::Cache)
18
+ @cache = DummyTDiary.new
19
+ @cache.tdiary = TDiaryMonth.new
20
+ @cache.store_cache(:foo, "foo")
21
+ end
22
+
23
+ it { expect(@cache.restore_cache("foo")).to eq :foo }
24
+ end
25
+
26
+ context "TDiaryMonth" do
27
+ before do
28
+ DummyTDiary.send(:include, TDiary::Cache)
29
+ @cache = DummyTDiary.new
30
+ @cache.tdiary = TDiaryLatest.new
31
+ end
32
+
33
+ context "given params" do
34
+ before do
35
+ @cache.tdiary.cgi.params = {'date' => ['20131110']}
36
+ @cache.should_not_receive(:store_data)
37
+ end
38
+ it { @cache.store_cache(:foo, "foo") }
39
+ end
40
+
41
+ context "not given params" do
42
+ before do
43
+ @cache.tdiary.cgi.params = {'date' => [nil]}
44
+ @cache.store_cache(:foo, "foo")
45
+ end
46
+ it { expect(@cache.restore_cache("foo")).to eq :foo }
47
+ end
10
48
  end
11
49
  end
@@ -1,16 +1,13 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'tdiary/cache/redis/version'
5
2
 
6
3
  Gem::Specification.new do |spec|
7
4
  spec.name = "tdiary-cache-redis"
8
- spec.version = Tdiary::Cache::Redis::VERSION
5
+ spec.version = "0.0.2"
9
6
  spec.authors = ["SHIBATA Hiroshi"]
10
7
  spec.email = ["shibata.hiroshi@gmail.com"]
11
8
  spec.summary = %q{tDiary cache with redis}
12
9
  spec.description = %q{tDiary cache with redis}
13
- spec.homepage = ""
10
+ spec.homepage = "https://github.com/tdiary/tdiary-cache-redis"
14
11
  spec.license = "MIT"
15
12
 
16
13
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-cache-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -95,11 +95,10 @@ files:
95
95
  - README.md
96
96
  - Rakefile
97
97
  - lib/tdiary/cache/redis.rb
98
- - lib/tdiary/cache/redis/version.rb
99
98
  - spec/spec_helper.rb
100
99
  - spec/tdiary/cache/redis_spec.rb
101
100
  - tdiary-cache-redis.gemspec
102
- homepage: ''
101
+ homepage: https://github.com/tdiary/tdiary-cache-redis
103
102
  licenses:
104
103
  - MIT
105
104
  metadata: {}
@@ -119,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  version: '0'
120
119
  requirements: []
121
120
  rubyforge_project:
122
- rubygems_version: 2.1.9
121
+ rubygems_version: 2.4.2
123
122
  signing_key:
124
123
  specification_version: 4
125
124
  summary: tDiary cache with redis
@@ -1,7 +0,0 @@
1
- module Tdiary
2
- module Cache
3
- module Redis
4
- VERSION = "0.0.1"
5
- end
6
- end
7
- end