tdiary-cache-redis 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/README.md +2 -6
- data/lib/tdiary/cache/redis.rb +1 -1
- data/spec/spec_helper.rb +35 -0
- data/spec/tdiary/cache/redis_spec.rb +43 -5
- data/tdiary-cache-redis.gemspec +2 -5
- metadata +4 -5
- data/lib/tdiary/cache/redis/version.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2af394ab6aa0656ec712df5f0ff74ad2f75c7de7
|
4
|
+
data.tar.gz: 22ee753d01f384cb77ae5e14bdfcf5237f0a9fe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08a64d5a66529e9c95ca597cd9c2cc3abced6946946007ddf0c6249a6727b2b98e3a4860c747684db7a881389bd5351ecf574dd2f156fd3dff6bb60ebcb0a9c7
|
7
|
+
data.tar.gz: d25c8520f050f03b23be120d615d188e6c5b6300e6153df86181596e0064becd10144144458424c7e02e37cd10715b59909ed777f37ae570c41d4d612998acd2
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# TDiary::Cache::Redis
|
2
2
|
|
3
|
-
|
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
|
data/lib/tdiary/cache/redis.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -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
|
4
|
-
|
5
|
-
|
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
|
-
|
9
|
-
|
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
|
data/tdiary-cache-redis.gemspec
CHANGED
@@ -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 =
|
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.
|
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:
|
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.
|
121
|
+
rubygems_version: 2.4.2
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: tDiary cache with redis
|