Skip to content

Commit 109720c

Browse files
committed
Specs: add metadata feature to metadata and expires proxies
1 parent be8430b commit 109720c

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

spec/moneta/adapters/gdbm/standard_gdbm_with_expires_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
let(:min_ttl) { t_res }
44
use_timecop
55

6-
moneta_store :GDBM do
7-
{file: File.join(tempdir, "simple_gdbm_with_expires"), expires: true}
6+
moneta_store :GDBM do |metadata: nil, **options|
7+
p metadata
8+
{file: File.join(tempdir, "simple_gdbm_with_expires"), expires: true, metadata: metadata}
89
end
910

10-
moneta_specs STANDARD_SPECS.without_multiprocess.with_expires.with_each_key
11+
moneta_specs STANDARD_SPECS.without_multiprocess.with_expires.with_each_key.with_metadata
1112
end

spec/moneta/proxies/expires/expires_file_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
use_timecop
66

7-
moneta_build do
7+
moneta_build do |metadata: nil, **options|
88
tempdir = self.tempdir
99
Moneta.build do
10-
use :Expires
10+
use :Expires, metadata: metadata
1111
use :Transformer, key: [:marshal, :escape], value: :marshal
1212
adapter :File, dir: File.join(tempdir, "expires-file")
1313
end
1414
end
1515

16-
moneta_specs STANDARD_SPECS.with_expires.stringvalues_only.with_each_key
16+
moneta_specs STANDARD_SPECS.with_expires.stringvalues_only.with_each_key.with_metadata
1717

1818
it 'deletes expired value in underlying file storage' do
1919
store.store('foo', 'bar', expires: 2)

spec/moneta/proxies/expires/expires_memory_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
use_timecop
66

7-
moneta_build do
7+
moneta_build do |metadata: nil, **options|
88
Moneta.build do
9-
use :Expires
10-
adapter :Memory
9+
use :Expires, metadata: metadata
10+
adapter :Memory, options
1111
end
1212
end
1313

14-
moneta_specs STANDARD_SPECS.without_transform.with_expires.without_persist.returnsame.with_each_key
14+
moneta_specs STANDARD_SPECS.without_transform.with_expires.without_persist.returnsame.with_each_key.with_metadata
1515

1616
it 'raises an exception when loading an invalid value' do
1717
store.store('key', 'unmarshalled value', raw: true)

spec/moneta/proxies/expires/expires_memory_with_default_expires_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use_timecop
66

7-
moneta_build do
7+
moneta_build do |metadata: nil, **options|
88
min_ttl = self.min_ttl
99
Moneta.build do
10-
use :Expires, expires: min_ttl
10+
use :Expires, expires: min_ttl, metadata: metadata
1111
adapter :Memory
1212
end
1313
end
1414

15-
moneta_specs STANDARD_SPECS.without_transform.with_expires.with_default_expires.without_persist.returnsame.with_each_key
15+
moneta_specs STANDARD_SPECS.without_transform.with_expires.with_default_expires.without_persist.returnsame.with_each_key.with_metadata
1616
end

spec/moneta/proxies/metadata/metdata_memory_spec.rb renamed to spec/moneta/proxies/metadata/metadata_memory_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
describe 'metadata_memory', proxy: :Metadata do
2-
moneta_build do
2+
moneta_build do |metadata: %i{test1 test2}, **options|
33
Moneta.build do
4-
use :Metadata, names: %i{test1 test2}
5-
adapter :Memory
4+
use :Metadata, metadata: metadata
5+
adapter :Memory, options
66
end
77
end
88

9-
moneta_specs STANDARD_SPECS.without_transform.without_persist.returnsame.with_each_key
9+
moneta_specs STANDARD_SPECS.without_transform.without_persist.returnsame.with_each_key.with_metadata
1010

1111
it 'raises an exception when loading an invalid value' do
1212
store.store('key', 'unmarshalled value', raw: true)

0 commit comments

Comments
 (0)