juno 0.2.0 → 0.2.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.
Files changed (41) hide show
  1. data/Gemfile +3 -2
  2. data/README.md +6 -1
  3. data/lib/juno.rb +20 -28
  4. data/lib/juno/adapters/activerecord.rb +24 -17
  5. data/lib/juno/adapters/couch.rb +6 -1
  6. data/lib/juno/adapters/datamapper.rb +7 -5
  7. data/lib/juno/adapters/sequel.rb +14 -7
  8. data/lib/juno/adapters/sqlite.rb +4 -4
  9. data/lib/juno/transformer.rb +14 -19
  10. data/lib/juno/version.rb +1 -1
  11. data/spec/adapter_activerecord_spec.rb +4 -4
  12. data/spec/adapter_datamapper_spec.rb +6 -6
  13. data/spec/adapter_sequel_spec.rb +2 -2
  14. data/spec/adapter_sqlite_spec.rb +2 -2
  15. data/spec/generate.rb +123 -18
  16. data/spec/junospecs.rb +63 -0
  17. data/spec/simpl_memory_with_expires_spec.rb +53 -0
  18. data/spec/simple_activerecord_spec.rb +2 -2
  19. data/spec/simple_activerecord_with_expires_spec.rb +53 -0
  20. data/spec/simple_couch_with_expires_spec.rb +53 -0
  21. data/spec/simple_datamapper_spec.rb +2 -2
  22. data/spec/simple_datamapper_with_expires_spec.rb +55 -0
  23. data/spec/simple_datamapper_with_repository_spec.rb +2 -2
  24. data/spec/simple_dbm_with_expires_spec.rb +53 -0
  25. data/spec/simple_file_with_expires_spec.rb +53 -0
  26. data/spec/simple_fog_with_expires_spec.rb +63 -0
  27. data/spec/simple_gdbm_with_expires_spec.rb +53 -0
  28. data/spec/simple_hashfile_with_expires_spec.rb +53 -0
  29. data/spec/simple_localmemcache_with_expires_spec.rb +53 -0
  30. data/spec/simple_memory_with_expires_spec.rb +53 -0
  31. data/spec/simple_mongo_with_expires_spec.rb +53 -0
  32. data/spec/simple_pstore_with_expires_spec.rb +53 -0
  33. data/spec/simple_riak_with_expires_spec.rb +57 -0
  34. data/spec/simple_sdbm_with_expires_spec.rb +53 -0
  35. data/spec/simple_sequel_spec.rb +2 -2
  36. data/spec/simple_sequel_with_expires_spec.rb +53 -0
  37. data/spec/simple_sqlite_spec.rb +2 -2
  38. data/spec/simple_sqlite_with_expires_spec.rb +53 -0
  39. data/spec/simple_tokyocabinet_with_expires_spec.rb +53 -0
  40. data/spec/simple_yaml_with_expires_spec.rb +53 -0
  41. metadata +40 -2
data/spec/generate.rb CHANGED
@@ -6,49 +6,104 @@ TESTS = {
6
6
  'simple_memory' => {
7
7
  :store => :Memory
8
8
  },
9
+ 'simple_memory_with_expires' => {
10
+ :store => :Memory,
11
+ :options => ':expires => true',
12
+ :specs => EXPIRES_SPECS,
13
+ },
9
14
  'simple_file' => {
10
15
  :store => :File,
11
16
  :options => ':dir => File.join(make_tempdir, "simple_file")'
12
17
  },
18
+ 'simple_file_with_expires' => {
19
+ :store => :File,
20
+ :options => ':dir => File.join(make_tempdir, "simple_file_with_expires"), :expires => true',
21
+ :specs => EXPIRES_SPECS
22
+ },
13
23
  'simple_hashfile' => {
14
24
  :store => :HashFile,
15
25
  :options => ':dir => File.join(make_tempdir, "simple_hashfile")'
16
26
  },
27
+ 'simple_hashfile_with_expires' => {
28
+ :store => :HashFile,
29
+ :options => ':dir => File.join(make_tempdir, "simple_hashfile_with_expires"), :expires => true',
30
+ :specs => EXPIRES_SPECS
31
+ },
17
32
  'simple_cassandra' => {
18
33
  :store => :Cassandra,
19
- :specs => EXPIRES_SPECS,
34
+ :specs => EXPIRES_SPECS
20
35
  },
21
36
  'simple_dbm' => {
22
37
  :store => :DBM,
23
38
  :options => ':file => File.join(make_tempdir, "simple_dbm")'
24
39
  },
40
+ 'simple_dbm_with_expires' => {
41
+ :store => :DBM,
42
+ :options => ':file => File.join(make_tempdir, "simple_dbm_with_expires"), :expires => true',
43
+ :specs => EXPIRES_SPECS
44
+ },
25
45
  'simple_gdbm' => {
26
46
  :store => :GDBM,
27
47
  :options => ':file => File.join(make_tempdir, "simple_gdbm")'
28
48
  },
49
+ 'simple_gdbm_with_expires' => {
50
+ :store => :GDBM,
51
+ :options => ':file => File.join(make_tempdir, "simple_gdbm_with_expires"), :expires => true',
52
+ :specs => EXPIRES_SPECS
53
+ },
29
54
  'simple_sdbm' => {
30
55
  :store => :SDBM,
31
56
  :options => ':file => File.join(make_tempdir, "simple_sdbm")'
32
57
  },
58
+ 'simple_sdbm_with_expires' => {
59
+ :store => :SDBM,
60
+ :options => ':file => File.join(make_tempdir, "simple_sdbm_with_expires"), :expires => true',
61
+ :specs => EXPIRES_SPECS
62
+ },
33
63
  'simple_pstore' => {
34
64
  :store => :PStore,
35
65
  :options => ':file => File.join(make_tempdir, "simple_pstore")'
36
66
  },
67
+ 'simple_pstore_with_expires' => {
68
+ :store => :PStore,
69
+ :options => ':file => File.join(make_tempdir, "simple_pstore_with_expires"), :expires => true',
70
+ :specs => EXPIRES_SPECS
71
+ },
37
72
  'simple_yaml' => {
38
73
  :store => :YAML,
39
74
  :options => ':file => File.join(make_tempdir, "simple_yaml")'
40
75
  },
76
+ 'simple_yaml_with_expires' => {
77
+ :store => :YAML,
78
+ :options => ':file => File.join(make_tempdir, "simple_yaml_with_expires"), :expires => true',
79
+ :specs => EXPIRES_SPECS
80
+ },
41
81
  'simple_localmemcache' => {
42
82
  :store => :LocalMemCache,
43
83
  :options => ':file => File.join(make_tempdir, "simple_localmemcache")'
44
84
  },
85
+ 'simple_localmemcache_with_expires' => {
86
+ :store => :LocalMemCache,
87
+ :options => ':file => File.join(make_tempdir, "simple_localmemcache_with_expires"), :expires => true',
88
+ :specs => EXPIRES_SPECS
89
+ },
45
90
  'simple_tokyocabinet' => {
46
91
  :store => :TokyoCabinet,
47
92
  :options => ':file => File.join(make_tempdir, "simple_tokyocabinet")'
48
93
  },
94
+ 'simple_tokyocabinet_with_expires' => {
95
+ :store => :TokyoCabinet,
96
+ :options => ':file => File.join(make_tempdir, "simple_tokyocabinet_with_expires"), :expires => true',
97
+ :specs => EXPIRES_SPECS
98
+ },
49
99
  'simple_sqlite' => {
50
100
  :store => :Sqlite,
51
- :options => ':file => ":memory:"'
101
+ :options => ':file => File.join(make_tempdir, "simple_sqlite")'
102
+ },
103
+ 'simple_sqlite_with_expires' => {
104
+ :store => :Sqlite,
105
+ :options => ':file => File.join(make_tempdir, "simple_sqlite_with_expires"), :expires => true',
106
+ :specs => EXPIRES_SPECS
52
107
  },
53
108
  'simple_redis' => {
54
109
  :store => :Redis,
@@ -75,14 +130,31 @@ TESTS = {
75
130
  # We don't want Riak warnings in tests
76
131
  :preamble => "require 'riak'\n\nRiak.disable_list_keys_warnings = true\n\n"
77
132
  },
133
+ 'simple_riak_with_expires' => {
134
+ :store => :Riak,
135
+ :options => ":bucket => 'simple_riak_with_expires', :expires => true",
136
+ # We don't want Riak warnings in tests
137
+ :preamble => "require 'riak'\n\nRiak.disable_list_keys_warnings = true\n\n",
138
+ :specs => EXPIRES_SPECS
139
+ },
78
140
  'simple_couch' => {
79
141
  :store => :Couch,
80
142
  :options => ":db => 'simple_couch'"
81
143
  },
144
+ 'simple_couch_with_expires' => {
145
+ :store => :Couch,
146
+ :options => ":db => 'simple_couch_with_expires', :expires => true",
147
+ :specs => EXPIRES_SPECS
148
+ },
82
149
  'simple_mongo' => {
83
150
  :store => :Mongo,
84
151
  :options => ":db => 'simple_mongo'"
85
152
  },
153
+ 'simple_mongo_with_expires' => {
154
+ :store => :Mongo,
155
+ :options => ":db => 'simple_mongo_with_expires', :expires => true",
156
+ :specs => EXPIRES_SPECS
157
+ },
86
158
  'simple_null' => {
87
159
  :store => :Null,
88
160
  :specs => [:null, :marshallable_key, :returndifferent]
@@ -93,23 +165,40 @@ TESTS = {
93
165
  },
94
166
  'simple_sequel' => {
95
167
  :store => :Sequel,
96
- :options => ":db => (defined?(JRUBY_VERSION) ? 'jdbc:sqlite:/' : 'sqlite:/')"
168
+ :options => ':db => (defined?(JRUBY_VERSION) ? "jdbc:sqlite:" : "sqlite:") + File.join(make_tempdir, "simple_sequel")'
169
+ },
170
+ 'simple_sequel_with_expires' => {
171
+ :store => :Sequel,
172
+ :options => ':db => (defined?(JRUBY_VERSION) ? "jdbc:sqlite:" : "sqlite:") + File.join(make_tempdir, "simple_sequel_with_expires"), :expires => true',
173
+ :specs => EXPIRES_SPECS
97
174
  },
98
175
  'simple_datamapper' => {
99
176
  :store => :DataMapper,
100
- :options => ':setup => "sqlite3://#{make_tempdir}/simple_datamapper-default.sqlite3"',
177
+ :options => ':setup => "sqlite3://#{make_tempdir}/simple_datamapper"',
101
178
  # DataMapper needs default repository to be setup
102
179
  :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n"
103
180
  },
181
+ 'simple_datamapper_with_expires' => {
182
+ :store => :DataMapper,
183
+ :options => ':setup => "sqlite3://#{make_tempdir}/simple_datamapper_with_expires", :expires => true',
184
+ # DataMapper needs default repository to be setup
185
+ :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n",
186
+ :specs => EXPIRES_SPECS
187
+ },
104
188
  'simple_datamapper_with_repository' => {
105
189
  :store => :DataMapper,
106
- :options => ':repository => :repo, :setup => "sqlite3://#{make_tempdir}/simple_datamapper-repo.sqlite3"',
190
+ :options => ':repository => :repo, :setup => "sqlite3://#{make_tempdir}/simple_datamapper_with_repository"',
107
191
  # DataMapper needs default repository to be setup
108
192
  :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n"
109
193
  },
110
194
  'simple_activerecord' => {
111
195
  :store => :ActiveRecord,
112
- :options => ":connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'simple_activerecord.sqlite3') }"
196
+ :options => ":connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'simple_activerecord') }"
197
+ },
198
+ 'simple_activerecord_with_expires' => {
199
+ :store => :ActiveRecord,
200
+ :options => ":connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'simple_activerecord_with_expires') }, :expires => true",
201
+ :specs => EXPIRES_SPECS
113
202
  },
114
203
  'simple_fog' => {
115
204
  :store => :Fog,
@@ -120,8 +209,17 @@ TESTS = {
120
209
  # Put Fog into testing mode
121
210
  :preamble => "require 'fog'\nFog.mock!\n"
122
211
  },
123
- # 'cache' => {
124
- # },
212
+ 'simple_fog_with_expires' => {
213
+ :store => :Fog,
214
+ :options => ":aws_access_key_id => 'fake_access_key_id',
215
+ :aws_secret_access_key => 'fake_secret_access_key',
216
+ :provider => 'AWS',
217
+ :dir => 'juno',
218
+ :expires => true",
219
+ # Put Fog into testing mode
220
+ :preamble => "require 'fog'\nFog.mock!\n",
221
+ :specs => EXPIRES_SPECS
222
+ },
125
223
  'expires_memory' => {
126
224
  :build => %{
127
225
  Juno.build do
@@ -307,18 +405,18 @@ end},
307
405
  :specs => [:null, :store, :returndifferent, :marshallable_key]
308
406
  },
309
407
  'adapter_activerecord' => {
310
- :build => "Juno::Adapters::ActiveRecord.new(:connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'adapter_activerecord.sqlite3') })",
408
+ :build => "Juno::Adapters::ActiveRecord.new(:connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'adapter_activerecord') })",
311
409
  :specs => ADAPTER_SPECS,
312
410
  :tests => %{
313
411
  it 'updates an existing key/value' do
314
412
  @store['foo/bar'] = '1'
315
413
  @store['foo/bar'] = '2'
316
- records = @store.table.find :all, :conditions => { :key => 'foo/bar' }
414
+ records = @store.table.find :all, :conditions => { :k => 'foo/bar' }
317
415
  records.count.should == 1
318
416
  end
319
417
 
320
418
  it 'uses an existing connection' do
321
- ActiveRecord::Base.establish_connection :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'activerecord-existing.sqlite3')
419
+ ActiveRecord::Base.establish_connection :adapter => (defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3'), :database => File.join(make_tempdir, 'activerecord-existing')
322
420
 
323
421
  store = Juno::Adapters::ActiveRecord.new
324
422
  store.table.table_exists?.should == true
@@ -334,7 +432,7 @@ end
334
432
  :specs => ADAPTER_SPECS
335
433
  },
336
434
  'adapter_datamapper' => {
337
- :build => 'Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/adapter_datamapper.sqlite3")',
435
+ :build => 'Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/adapter_datamapper")',
338
436
  # DataMapper needs default repository to be setup
339
437
  :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n",
340
438
  :specs => ADAPTER_SPECS + [:returndifferent_stringkey_objectvalue,
@@ -342,10 +440,10 @@ end
342
440
  :store_stringkey_objectvalue],
343
441
  :tests => %q{
344
442
  it 'does not cross contaminate when storing' do
345
- first = Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first.sqlite3")
443
+ first = Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first")
346
444
  first.clear
347
445
 
348
- second = Juno::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second.sqlite3")
446
+ second = Juno::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second")
349
447
  second.clear
350
448
 
351
449
  first['key'] = 'value'
@@ -356,10 +454,10 @@ it 'does not cross contaminate when storing' do
356
454
  end
357
455
 
358
456
  it 'does not cross contaminate when deleting' do
359
- first = Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first.sqlite3")
457
+ first = Juno::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first")
360
458
  first.clear
361
459
 
362
- second = Juno::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second.sqlite3")
460
+ second = Juno::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second")
363
461
  second.clear
364
462
 
365
463
  first['key'] = 'value'
@@ -438,11 +536,11 @@ end
438
536
  :specs => ADAPTER_SPECS
439
537
  },
440
538
  'adapter_sequel' => {
441
- :build => "Juno::Adapters::Sequel.new(:db => (defined?(JRUBY_VERSION) ? 'jdbc:sqlite:/' : 'sqlite:/'))",
539
+ :build => 'Juno::Adapters::Sequel.new(:db => (defined?(JRUBY_VERSION) ? "jdbc:sqlite:" : "sqlite:") + File.join(make_tempdir, "adapter_sequel"))',
442
540
  :specs => ADAPTER_SPECS
443
541
  },
444
542
  'adapter_sqlite' => {
445
- :build => 'Juno::Adapters::Sqlite.new(:file => ":memory:")',
543
+ :build => 'Juno::Adapters::Sqlite.new(:file => File.join(make_tempdir, "adapter_sqlite"))',
446
544
  :specs => ADAPTER_SPECS
447
545
  },
448
546
  'adapter_tokyocabinet' => {
@@ -547,6 +645,13 @@ it "removes and returns a #{val_type} element with a #{key_type} key from the ba
547
645
  @store.key?(#{key1}).should == false
548
646
  end
549
647
 
648
+ it "overwrites existing #{val_type} values with #{key_type}" do
649
+ @store[#{key1}] = #{val1}
650
+ @store[#{key1}].should == #{val1}
651
+ @store[#{key1}] = #{val2}
652
+ @store[#{key1}].should == #{val2}
653
+ end
654
+
550
655
  it "does not run the block if the #{key_type} key is available" do
551
656
  @store[#{key1}] = #{val1}
552
657
  unaltered = "unaltered"
data/spec/junospecs.rb CHANGED
@@ -77,6 +77,13 @@ shared_examples_for 'store_stringkey_stringvalue' do
77
77
  @store.key?("strkey1").should == false
78
78
  end
79
79
 
80
+ it "overwrites existing String values with String" do
81
+ @store["strkey1"] = "strval1"
82
+ @store["strkey1"].should == "strval1"
83
+ @store["strkey1"] = "strval2"
84
+ @store["strkey1"].should == "strval2"
85
+ end
86
+
80
87
  it "does not run the block if the String key is available" do
81
88
  @store["strkey1"] = "strval1"
82
89
  unaltered = "unaltered"
@@ -243,6 +250,13 @@ shared_examples_for 'store_stringkey_objectvalue' do
243
250
  @store.key?("strkey1").should == false
244
251
  end
245
252
 
253
+ it "overwrites existing Object values with String" do
254
+ @store["strkey1"] = Value.new(:objval1)
255
+ @store["strkey1"].should == Value.new(:objval1)
256
+ @store["strkey1"] = Value.new(:objval2)
257
+ @store["strkey1"].should == Value.new(:objval2)
258
+ end
259
+
246
260
  it "does not run the block if the String key is available" do
247
261
  @store["strkey1"] = Value.new(:objval1)
248
262
  unaltered = "unaltered"
@@ -409,6 +423,13 @@ shared_examples_for 'store_stringkey_hashvalue' do
409
423
  @store.key?("strkey1").should == false
410
424
  end
411
425
 
426
+ it "overwrites existing Hash values with String" do
427
+ @store["strkey1"] = {"hashval1"=>"hashval2"}
428
+ @store["strkey1"].should == {"hashval1"=>"hashval2"}
429
+ @store["strkey1"] = {"hashval3"=>"hashval4"}
430
+ @store["strkey1"].should == {"hashval3"=>"hashval4"}
431
+ end
432
+
412
433
  it "does not run the block if the String key is available" do
413
434
  @store["strkey1"] = {"hashval1"=>"hashval2"}
414
435
  unaltered = "unaltered"
@@ -575,6 +596,13 @@ shared_examples_for 'store_objectkey_stringvalue' do
575
596
  @store.key?(Value.new(:objkey1)).should == false
576
597
  end
577
598
 
599
+ it "overwrites existing String values with Object" do
600
+ @store[Value.new(:objkey1)] = "strval1"
601
+ @store[Value.new(:objkey1)].should == "strval1"
602
+ @store[Value.new(:objkey1)] = "strval2"
603
+ @store[Value.new(:objkey1)].should == "strval2"
604
+ end
605
+
578
606
  it "does not run the block if the Object key is available" do
579
607
  @store[Value.new(:objkey1)] = "strval1"
580
608
  unaltered = "unaltered"
@@ -741,6 +769,13 @@ shared_examples_for 'store_objectkey_objectvalue' do
741
769
  @store.key?(Value.new(:objkey1)).should == false
742
770
  end
743
771
 
772
+ it "overwrites existing Object values with Object" do
773
+ @store[Value.new(:objkey1)] = Value.new(:objval1)
774
+ @store[Value.new(:objkey1)].should == Value.new(:objval1)
775
+ @store[Value.new(:objkey1)] = Value.new(:objval2)
776
+ @store[Value.new(:objkey1)].should == Value.new(:objval2)
777
+ end
778
+
744
779
  it "does not run the block if the Object key is available" do
745
780
  @store[Value.new(:objkey1)] = Value.new(:objval1)
746
781
  unaltered = "unaltered"
@@ -907,6 +942,13 @@ shared_examples_for 'store_objectkey_hashvalue' do
907
942
  @store.key?(Value.new(:objkey1)).should == false
908
943
  end
909
944
 
945
+ it "overwrites existing Hash values with Object" do
946
+ @store[Value.new(:objkey1)] = {"hashval1"=>"hashval2"}
947
+ @store[Value.new(:objkey1)].should == {"hashval1"=>"hashval2"}
948
+ @store[Value.new(:objkey1)] = {"hashval3"=>"hashval4"}
949
+ @store[Value.new(:objkey1)].should == {"hashval3"=>"hashval4"}
950
+ end
951
+
910
952
  it "does not run the block if the Object key is available" do
911
953
  @store[Value.new(:objkey1)] = {"hashval1"=>"hashval2"}
912
954
  unaltered = "unaltered"
@@ -1073,6 +1115,13 @@ shared_examples_for 'store_hashkey_stringvalue' do
1073
1115
  @store.key?({"hashkey1"=>"hashkey2"}).should == false
1074
1116
  end
1075
1117
 
1118
+ it "overwrites existing String values with Hash" do
1119
+ @store[{"hashkey1"=>"hashkey2"}] = "strval1"
1120
+ @store[{"hashkey1"=>"hashkey2"}].should == "strval1"
1121
+ @store[{"hashkey1"=>"hashkey2"}] = "strval2"
1122
+ @store[{"hashkey1"=>"hashkey2"}].should == "strval2"
1123
+ end
1124
+
1076
1125
  it "does not run the block if the Hash key is available" do
1077
1126
  @store[{"hashkey1"=>"hashkey2"}] = "strval1"
1078
1127
  unaltered = "unaltered"
@@ -1239,6 +1288,13 @@ shared_examples_for 'store_hashkey_objectvalue' do
1239
1288
  @store.key?({"hashkey1"=>"hashkey2"}).should == false
1240
1289
  end
1241
1290
 
1291
+ it "overwrites existing Object values with Hash" do
1292
+ @store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1)
1293
+ @store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1)
1294
+ @store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2)
1295
+ @store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2)
1296
+ end
1297
+
1242
1298
  it "does not run the block if the Hash key is available" do
1243
1299
  @store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1)
1244
1300
  unaltered = "unaltered"
@@ -1405,6 +1461,13 @@ shared_examples_for 'store_hashkey_hashvalue' do
1405
1461
  @store.key?({"hashkey1"=>"hashkey2"}).should == false
1406
1462
  end
1407
1463
 
1464
+ it "overwrites existing Hash values with Hash" do
1465
+ @store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>"hashval2"}
1466
+ @store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>"hashval2"}
1467
+ @store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>"hashval4"}
1468
+ @store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>"hashval4"}
1469
+ end
1470
+
1408
1471
  it "does not run the block if the Hash key is available" do
1409
1472
  @store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>"hashval2"}
1410
1473
  unaltered = "unaltered"
@@ -0,0 +1,53 @@
1
+ # Generated file
2
+ require 'helper'
3
+
4
+ begin
5
+ Juno.new(:Memory, :expires => true).close
6
+
7
+ describe "simpl_memory_with_expires" do
8
+ before do
9
+ @store = Juno.new(:Memory, :expires => true)
10
+ @store.clear
11
+ end
12
+
13
+ after do
14
+ @store.close.should == nil if @store
15
+ end
16
+
17
+ it_should_behave_like 'null_objectkey_objectvalue'
18
+ it_should_behave_like 'null_objectkey_stringvalue'
19
+ it_should_behave_like 'null_objectkey_hashvalue'
20
+ it_should_behave_like 'null_stringkey_objectvalue'
21
+ it_should_behave_like 'null_stringkey_stringvalue'
22
+ it_should_behave_like 'null_stringkey_hashvalue'
23
+ it_should_behave_like 'null_hashkey_objectvalue'
24
+ it_should_behave_like 'null_hashkey_stringvalue'
25
+ it_should_behave_like 'null_hashkey_hashvalue'
26
+ it_should_behave_like 'store_objectkey_objectvalue'
27
+ it_should_behave_like 'store_objectkey_stringvalue'
28
+ it_should_behave_like 'store_objectkey_hashvalue'
29
+ it_should_behave_like 'store_stringkey_objectvalue'
30
+ it_should_behave_like 'store_stringkey_stringvalue'
31
+ it_should_behave_like 'store_stringkey_hashvalue'
32
+ it_should_behave_like 'store_hashkey_objectvalue'
33
+ it_should_behave_like 'store_hashkey_stringvalue'
34
+ it_should_behave_like 'store_hashkey_hashvalue'
35
+ it_should_behave_like 'returndifferent_objectkey_objectvalue'
36
+ it_should_behave_like 'returndifferent_objectkey_stringvalue'
37
+ it_should_behave_like 'returndifferent_objectkey_hashvalue'
38
+ it_should_behave_like 'returndifferent_stringkey_objectvalue'
39
+ it_should_behave_like 'returndifferent_stringkey_stringvalue'
40
+ it_should_behave_like 'returndifferent_stringkey_hashvalue'
41
+ it_should_behave_like 'returndifferent_hashkey_objectvalue'
42
+ it_should_behave_like 'returndifferent_hashkey_stringvalue'
43
+ it_should_behave_like 'returndifferent_hashkey_hashvalue'
44
+ it_should_behave_like 'marshallable_key'
45
+ it_should_behave_like 'expires_stringkey_stringvalue'
46
+
47
+ end
48
+ rescue LoadError => ex
49
+ puts "Test simpl_memory_with_expires not executed: #{ex.message}"
50
+ rescue Exception => ex
51
+ puts "Test simpl_memory_with_expires not executed: #{ex.message}"
52
+ #puts "#{ex.backtrace.join("\n")}"
53
+ end