alephant-cache 2.0.0 → 2.0.1
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/lib/alephant/cache.rb +1 -1
- data/lib/alephant/cache/version.rb +1 -1
- data/spec/cache_spec.rb +14 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32188fc17c39c5964aad1e0980c703738c91262
|
4
|
+
data.tar.gz: 54998d2325491884a905336a8df97cb49e08c2d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1218cc9a8fc5f6a597af5746b701c9cc95491e9bfc82025b968de3f96c42f60d4a3ba3c7e07907986493318d61ccd51aadbf9c5fff07c698cc49ff2bd9737cda
|
7
|
+
data.tar.gz: 63d1a276ef827aea735c910bf587adb79996b1af6ee195ea02f2024046416e0d20c9109309c65c9ddd8a426e1d5d22393913700097bdaf07bd5694f539add737
|
data/lib/alephant/cache.rb
CHANGED
data/spec/cache_spec.rb
CHANGED
@@ -26,19 +26,19 @@ describe Alephant::Cache do
|
|
26
26
|
let(:num_object_in_path) { 100 }
|
27
27
|
it "deletes all objects for a path" do
|
28
28
|
filtered_object_collection = double()
|
29
|
-
filtered_object_collection
|
30
|
-
.
|
29
|
+
expect(filtered_object_collection)
|
30
|
+
.to receive(:delete_all)
|
31
31
|
|
32
32
|
s3_object_collection = double()
|
33
|
-
s3_object_collection
|
34
|
-
.
|
33
|
+
expect(s3_object_collection)
|
34
|
+
.to receive(:with_prefix)
|
35
35
|
.with(path)
|
36
36
|
.and_return(filtered_object_collection)
|
37
37
|
|
38
38
|
s3_bucket = double()
|
39
|
-
s3_bucket.
|
39
|
+
expect(s3_bucket).to receive(:objects).and_return(s3_object_collection)
|
40
40
|
|
41
|
-
AWS::S3.
|
41
|
+
expect_any_instance_of(AWS::S3).to receive(:buckets).and_return({ id => s3_bucket })
|
42
42
|
|
43
43
|
instance = subject.new(id, path)
|
44
44
|
instance.clear
|
@@ -48,16 +48,16 @@ describe Alephant::Cache do
|
|
48
48
|
describe "put(id, data)" do
|
49
49
|
it "sets bucket path/id content data" do
|
50
50
|
s3_object_collection = double()
|
51
|
-
s3_object_collection.
|
51
|
+
expect(s3_object_collection).to receive(:write).with(:data, { :content_type => 'foo/bar', :metadata=>{} })
|
52
52
|
|
53
53
|
s3_bucket = double()
|
54
|
-
s3_bucket.
|
54
|
+
expect(s3_bucket).to receive(:objects).and_return(
|
55
55
|
{
|
56
56
|
"path/id" => s3_object_collection
|
57
57
|
}
|
58
58
|
)
|
59
59
|
|
60
|
-
AWS::S3.
|
60
|
+
expect_any_instance_of(AWS::S3).to receive(:buckets).and_return({ id => s3_bucket })
|
61
61
|
instance = subject.new(id, path)
|
62
62
|
|
63
63
|
instance.put(id, data, 'foo/bar')
|
@@ -67,18 +67,18 @@ describe Alephant::Cache do
|
|
67
67
|
describe "get(id)" do
|
68
68
|
it "gets bucket path/id content data" do
|
69
69
|
s3_object_collection = double()
|
70
|
-
s3_object_collection.
|
71
|
-
s3_object_collection.
|
72
|
-
s3_object_collection.
|
70
|
+
expect(s3_object_collection).to receive(:read).and_return("content")
|
71
|
+
expect(s3_object_collection).to receive(:content_type).and_return("foo/bar")
|
72
|
+
expect(s3_object_collection).to receive(:metadata).and_return({ :foo => :bar})
|
73
73
|
|
74
74
|
s3_bucket = double()
|
75
|
-
s3_bucket.
|
75
|
+
expect(s3_bucket).to receive(:objects).and_return(
|
76
76
|
{
|
77
77
|
"path/id" => s3_object_collection
|
78
78
|
}
|
79
79
|
)
|
80
80
|
|
81
|
-
AWS::S3.
|
81
|
+
expect_any_instance_of(AWS::S3).to receive(:buckets).and_return({ id => s3_bucket })
|
82
82
|
|
83
83
|
instance = subject.new(id, path)
|
84
84
|
object_hash = instance.get(id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|