baccigalupi-aqua 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aqua}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kane Baccigalupi"]
12
- s.date = %q{2009-08-25}
12
+ s.date = %q{2009-08-27}
13
13
  s.description = %q{Even with ORMs like ActiveRecord, DataMapper which ease the pain of relational data storage, considerable developer effort goes into wrangling Ruby objects into their databases. Document-oriented databases have made it possible to store nested data structures that easily map to Ruby objects. Aqua (http://github.com/baccigalupi/aqua) is a new Ruby library that aims to painlessly persists objects, allowing developers to focus more on object oriented code and less on storage. Currently Aqua is in pre-alpha testing, with the following big things left to implement: A data query DSL and implementation; Support of all objects in the Standard Library; Class and code storage to allow the sharing and persistence of classes with their data.}
14
14
  s.email = %q{baccigalupi@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -74,6 +74,7 @@ Gem::Specification.new do |s|
74
74
  "lib/aqua/object/extensions/validation.rb",
75
75
  "lib/aqua/object/pack.rb",
76
76
  "lib/aqua/object/query.rb",
77
+ "lib/aqua/object/stub.rb",
77
78
  "lib/aqua/object/tank.rb",
78
79
  "lib/aqua/object/unpack.rb",
79
80
  "lib/aqua/store/couch_db/couch_db.rb",
@@ -89,12 +90,14 @@ Gem::Specification.new do |s|
89
90
  "spec/object/config_spec.rb",
90
91
  "spec/object/object_fixtures/array_udder.rb",
91
92
  "spec/object/object_fixtures/canned_hash.rb",
93
+ "spec/object/object_fixtures/gerbilmiester.rb",
92
94
  "spec/object/object_fixtures/grounded.rb",
93
95
  "spec/object/object_fixtures/log.rb",
94
96
  "spec/object/object_fixtures/persistent.rb",
95
97
  "spec/object/object_fixtures/user.rb",
96
98
  "spec/object/pack_spec.rb",
97
99
  "spec/object/query_spec.rb",
100
+ "spec/object/stub_spec.rb",
98
101
  "spec/object/tank_spec.rb",
99
102
  "spec/object/unpack_spec.rb",
100
103
  "spec/spec.opts",
@@ -118,12 +121,14 @@ Gem::Specification.new do |s|
118
121
  "spec/object/config_spec.rb",
119
122
  "spec/object/object_fixtures/array_udder.rb",
120
123
  "spec/object/object_fixtures/canned_hash.rb",
124
+ "spec/object/object_fixtures/gerbilmiester.rb",
121
125
  "spec/object/object_fixtures/grounded.rb",
122
126
  "spec/object/object_fixtures/log.rb",
123
127
  "spec/object/object_fixtures/persistent.rb",
124
128
  "spec/object/object_fixtures/user.rb",
125
129
  "spec/object/pack_spec.rb",
126
130
  "spec/object/query_spec.rb",
131
+ "spec/object/stub_spec.rb",
127
132
  "spec/object/tank_spec.rb",
128
133
  "spec/object/unpack_spec.rb",
129
134
  "spec/spec_helper.rb",
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -69,6 +69,7 @@ module Aqua::Pack
69
69
  self.__pack[:_rev] = _rev if _rev
70
70
  self.__pack[:class] = class_name
71
71
  self.__pack[:keys] = []
72
+ self.__pack[:stubs] = []
72
73
  _pack_properties
73
74
  _pack_singletons
74
75
  __pack
@@ -91,7 +92,9 @@ module Aqua::Pack
91
92
  # @api private
92
93
  def _storable_attributes
93
94
  (instance_variables||[]) - self.class._hidden_attributes
94
- end
95
+ end
96
+
97
+ attr_accessor :_warnings
95
98
 
96
99
  # Private/protected methods are all prefaced by an underscore to prevent
97
100
  # clogging the object instance space. Some of the public ones above are too!
@@ -193,19 +196,33 @@ module Aqua::Pack
193
196
  else # a more complex object, including an array or a hash like thing
194
197
  return_hash = {}
195
198
  if obj.aquatic?
196
- # TODO distinguish between internal storage, stubbing and external (obj.aquatic? && obj._embed_me == true)
197
- return_hash = obj._pack
199
+ if obj._embed_me == true
200
+ return_hash = obj._pack
201
+ else
202
+ return_hash['class'] = 'Aqua::Stub'
203
+ index = self.__pack[:keys].length
204
+ stub = { :class => klass.to_s, :id => obj }
205
+ if obj._embed_me.keys && stub_methods = obj._embed_me[:stub]
206
+ stub[:methods] = {}
207
+ if stub_methods.class == Symbol || stub_methods.class == String
208
+ stub_method = stub_methods.to_sym
209
+ stub[:methods][stub_method] = obj.send( stub_method )
210
+ else # is an array of values
211
+ stub_methods.each do |meth|
212
+ stub_method = meth.to_sym
213
+ stub[:methods][stub_method] = obj.send( stub_method )
214
+ end
215
+ end
216
+ end
217
+ self.__pack[:stubs] << stub
218
+ return_hash['init'] = "/STUB_#{index}"
219
+ end
198
220
  elsif !obj.aquatic?
199
221
  initialization = _pack_initializations( obj )
200
222
  return_hash['init'] = initialization unless initialization.empty?
201
223
  data = _pack_ivars( obj )
202
224
  return_hash['ivars'] = data unless data.empty?
203
225
  return_hash['class'] = klass.to_s
204
- # TODO: distinguish between internal storage, stubbing and external (obj.aquatic? && obj._embed_me == true)
205
- # elsif obj._embed_me.class == Hash
206
- # return_hash = _stub( obj )
207
- # else
208
- # return_hash = _pack_to_external(obj)
209
226
  end
210
227
  return_hash
211
228
  end
@@ -257,10 +274,28 @@ module Aqua::Pack
257
274
  # Also learn the library usage, without any docs :(
258
275
  end
259
276
 
260
- def _save_to_store
277
+ def _save_to_store
278
+ self._warnings = []
279
+ _commit_externals
261
280
  __pack.commit
262
281
  end
263
282
 
283
+ def _commit_externals
284
+ __pack[:stubs].each_with_index do |obj_hash, index|
285
+ obj = obj_hash[:id]
286
+ if obj.commit
287
+ obj_hash[:id] = obj.id
288
+ else
289
+ if obj.id
290
+ self._warnings << "Unable to save latest version of #{obj.inspect}, stubbed at index #{index}"
291
+ obj_hash[:id] = obj.id if obj.id
292
+ else
293
+ self._warnings << "Unable to save #{obj.inspect}, stubbed at index #{index}"
294
+ end
295
+ end
296
+ end
297
+ end
298
+
264
299
  def _clear_accessors
265
300
  self.__pack = nil
266
301
  self._store = nil
@@ -0,0 +1,68 @@
1
+ # NOTES: I just checked and Delegator does all its delegation through method missing, so
2
+ # it probably makes sense to make this all one class, with method_missing doing the work.
3
+
4
+ module Aqua
5
+ class TempStub
6
+ def initialize( method_hash )
7
+ method_hash.each do |method_name, value|
8
+ self.class.class_eval("
9
+ def #{method_name}
10
+ #{value.inspect}
11
+ end
12
+ ")
13
+ end
14
+ end
15
+ end
16
+
17
+ class Stub < Delegator
18
+
19
+ # Builds a new stub object which returns cached/stubbed methods until such a time as a non-cached method
20
+ # is requested.
21
+ #
22
+ # @param [Hash]
23
+ # @option opts [Array] :methods A hash of method names and values
24
+ # @option opts [String] :class The class of the object being stubbed
25
+ # @option opts [String] :id The id of the object being stubbed
26
+ #
27
+ # @api semi-public
28
+ def initialize( opts )
29
+ meths = opts[:methods] || {}
30
+ temp_stub = TempStub.new( meths )
31
+ super( temp_stub )
32
+ @_sd_obj = temp_stub
33
+ self.delegate_class = opts[:class]
34
+ self.delegate_id = opts[:id]
35
+ end
36
+
37
+ protected
38
+ attr_accessor :delegate_class, :delegate_id
39
+
40
+ def method_missing( method, *args )
41
+ if __getobj__.class.to_s != delegate_class.to_s
42
+ load_delegate
43
+ # resend!
44
+ if (args.size == 1 && !args.first.nil?)
45
+ __getobj__.send( method.to_sym, eval(args.map{|value| "'#{value}'"}.join(', ')) )
46
+ else
47
+ __getobj__.send( method.to_sym )
48
+ end
49
+ else
50
+ raise NoMethodError
51
+ end
52
+ end
53
+
54
+ def __getobj__
55
+ @_sd_obj # return object we are delegating to, required
56
+ end
57
+
58
+ def __setobj__(obj)
59
+ @_sd_obj = obj # change delegation object, a feature we're providing
60
+ end
61
+
62
+ def load_delegate
63
+ __setobj__( delegate_class.constantize.load( delegate_id ) )
64
+ end
65
+ public
66
+
67
+ end
68
+ end
@@ -3,6 +3,7 @@ require dir + '/pack'
3
3
  require dir + '/query'
4
4
  require dir + '/unpack'
5
5
  require dir + '/config'
6
+ require dir + '/stub'
6
7
 
7
8
  module Aqua::Tank
8
9
  def self.included( klass )
@@ -74,7 +74,7 @@ module Aqua::Unpack
74
74
  data_package
75
75
  else
76
76
  _unpack_object( data_package )
77
- end
77
+ end
78
78
  obj.instance_variable_set( ivar_name, unpacked )
79
79
  end
80
80
  end
@@ -82,15 +82,24 @@ module Aqua::Unpack
82
82
  def _unpack_initialization( obj )
83
83
  if init = obj[:init]
84
84
  init_class = init.class
85
- if init_class == String
86
- init
85
+ if init_class == String
86
+ if init.match(/\A\/STUB_(\d*)\z/)
87
+ _unpack_stub( $1.to_i )
88
+ else
89
+ init
90
+ end
87
91
  elsif init.class == Array
88
92
  _unpack_array( init )
89
93
  else
90
94
  _unpack_hash( init )
91
95
  end
92
96
  end
93
- end
97
+ end
98
+
99
+ def _unpack_stub( index )
100
+ hash = _store[:stubs][index]
101
+ Aqua::Stub.new( hash )
102
+ end
94
103
 
95
104
  def _unpack_array( obj )
96
105
  arr = []
@@ -144,7 +153,6 @@ module Aqua::Unpack
144
153
  elsif obj_class && obj_class != Array
145
154
  obj_class.new.replace( init )
146
155
  else
147
- # should log an error internally
148
156
  init
149
157
  end
150
158
  elsif init_class.ancestors.include?( Hash )
@@ -156,7 +164,7 @@ module Aqua::Unpack
156
164
  # should log an error internally
157
165
  init
158
166
  end
159
- else # is a string
167
+ else # is a string
160
168
  if obj_class == Date || obj_class == Time
161
169
  obj_class.parse( init )
162
170
  elsif [Fixnum, Bignum].include?( obj_class )
@@ -167,7 +175,9 @@ module Aqua::Unpack
167
175
  true
168
176
  elsif obj_class == FalseClass
169
177
  false
170
- else
178
+ elsif obj_class == Aqua::Stub
179
+ init
180
+ else
171
181
  nil
172
182
  end
173
183
  end
@@ -7,7 +7,7 @@ describe Aqua::Config do
7
7
  end
8
8
 
9
9
  it 'should set default configuration options on module load' do
10
- opts = User.aquatic_options
10
+ opts = Persistent.aquatic_options
11
11
  opts.should_not be_nil
12
12
  opts[:database].should be_nil
13
13
  opts[:embed].should be_false
@@ -0,0 +1,18 @@
1
+ class Gerbilmiester
2
+ aquatic :embed => [:gerbil, :bacon]
3
+
4
+ # saved state instance variable
5
+ def gerbil
6
+ @gerbil ||= true
7
+ end
8
+
9
+ # not an instance method with saved state,
10
+ # but we should be able to stub this.
11
+ def bacon
12
+ 'chunky'
13
+ end
14
+
15
+ def herd
16
+ gerbil ? 'Yah, yah, little gerbil' : 'Nothing to herd here, move along!'
17
+ end
18
+ end
@@ -1,4 +1,12 @@
1
1
  class Persistent
2
- include Aqua::Pack
2
+ include Aqua::Tank
3
+
4
+ # for testing class level configuration options
5
+ def self.aquatic_options
6
+ _aqua_opts
7
+ end
8
+
9
+
10
+
3
11
  end
4
12
 
@@ -1,5 +1,5 @@
1
1
  class User
2
- include Aqua::Tank
2
+ aquatic :embed => { :stub => :username }
3
3
 
4
4
  attr_accessor :name, # An array of strings or a hash of strings
5
5
  :created_at,# Time
@@ -7,7 +7,8 @@ class User
7
7
  :username, # simple string
8
8
  :log, # an Aquatic Object
9
9
  :password, # hidden value
10
- :grab_bag # non Aquatic Object
10
+ :grab_bag, # non Aquatic Object
11
+ :other_user # a non-embeddable Aquatic Object
11
12
  hide_attributes :password
12
13
 
13
14
  def initialize( hash={} )
@@ -33,12 +33,93 @@ describe Aqua::Pack do
33
33
  it 'should be saved into the design document'
34
34
  end
35
35
 
36
- describe 'stubing objects' do
37
- it 'should save as a stub any aquatic object declared as unembeddable'
38
- it 'should have class "stub"'
39
- it 'should have an object id'
40
- it 'should cache any methods declared in the class opts for that class'
41
- end
36
+ describe 'external saves and stubs' do
37
+ before(:each) do
38
+ CouchDB.server.delete_all
39
+ @graeme = User.new(:username => 'graeme', :name => ['Graeme', 'Nelson'])
40
+ @user.other_user = @graeme
41
+ @pack = @user._pack
42
+ end
43
+
44
+ describe 'packing' do
45
+ it 'should pack a stubbed object representation under __pack[:stubs]' do
46
+ @pack[:stubs].size.should == 1
47
+ other_user_pack = @pack[:stubs].first
48
+ other_user_pack[:class].should == "User"
49
+ other_user_pack[:id].should == @graeme
50
+ end
51
+
52
+ it 'should pack the values of a stubbed methods' do
53
+ other_user_pack = @pack[:stubs].first
54
+ other_user_pack[:methods].size.should == 1
55
+ other_user_pack[:methods][:username].should == 'graeme'
56
+ end
57
+
58
+ it 'should pack an array of stubbed methods' do
59
+ User.configure_aqua( :embed => {:stub => [:username, :name] } )
60
+ @user = User.new(
61
+ :username => 'kane',
62
+ :name => ['Kane', 'Baccigalupi'],
63
+ :dob => @date,
64
+ :created_at => @time,
65
+ :log => @log,
66
+ :password => 'my secret!',
67
+ :other_user => @graeme
68
+ )
69
+
70
+ @pack = @user._pack
71
+ other_user_pack = @pack[:stubs].first
72
+ other_user_pack[:methods].size.should == 2
73
+ other_user_pack[:methods][:username].should == 'graeme'
74
+ other_user_pack[:methods][:name].should == ['Graeme', 'Nelson']
75
+
76
+ # reseting the User model, and @user instance
77
+ User.configure_aqua( :embed => {:stub => :username } )
78
+ end
79
+
80
+ it 'should pack the object itself with the class "Aqua::Stub"' do
81
+ @pack[:ivars][:@other_user][:class].should == "Aqua::Stub"
82
+ end
83
+
84
+ it 'should pack the object itself with a reference to the __pack[:stubs] object' do
85
+ @pack[:ivars][:@other_user][:init].should == "/STUB_0"
86
+ end
87
+ end
88
+
89
+ describe 'commiting' do
90
+ it 'should commit external objects' do
91
+ @user.commit!
92
+ db_docs = CouchDB::Database.new.documents
93
+ db_docs['total_rows'].should == 2
94
+ end
95
+
96
+ it 'should save the id to the stub after commiting' do
97
+ @user.commit!
98
+ doc = CouchDB.get( "http://127.0.0.1:5984/aqua/#{@user.id}" )
99
+ doc["stubs"].first["id"].class.should == String
100
+ end
101
+
102
+ it 'should log a warning if an external object doesn\'t commit' do
103
+ @graeme.should_receive(:commit).and_return(false)
104
+ @user.commit!
105
+ @user._warnings.size.should == 1
106
+ @user._warnings.first.should match(/unable to save/i)
107
+ end
108
+
109
+ it 'should log a warning and save the id if an object has an id' do
110
+ @graeme.commit!
111
+ @graeme.should_receive(:commit).and_return(false)
112
+ @user.commit!
113
+ @user._warnings.size.should == 1
114
+ @user._warnings.first.should match(/unable to save latest/i)
115
+ doc = CouchDB.get( "http://127.0.0.1:5984/aqua/#{@user.id}" )
116
+ doc["stubs"].first["id"].class.should == String
117
+ end
118
+
119
+ it 'should rollback external commits if the parent object doesn\'t save'
120
+ end
121
+
122
+ end
42
123
 
43
124
  describe 'hiding attributes' do
44
125
  it 'should add a class method for designating hidden instance variables' do
@@ -211,16 +292,16 @@ describe Aqua::Pack do
211
292
 
212
293
  describe 'embeddable aquatic' do
213
294
  it 'aquatic objects should have packing instructions in the form of #_embed_me' do
214
- @user._embed_me.should == false
295
+ @user._embed_me.should == {'stub' => :username }
215
296
  Log.new._embed_me.should == true
216
297
  User.configure_aqua( :embed => {:stub => [:username, :name] } )
217
298
  @user._embed_me.should == { 'stub' => [:username, :name] }
218
299
  # reset for future tests
219
- User.configure_aqua( :embed => false )
300
+ User.configure_aqua( :embed => {:stub => :username } )
220
301
  end
221
302
 
222
303
  it 'should save their ivars correctly' do
223
- @pack[:ivars][:@log].keys.sort.should == ['class', 'ivars', 'keys']
304
+ @pack[:ivars][:@log].keys.should include('ivars')
224
305
  @pack[:ivars][:@log]['ivars'].keys.should == ['@created_at', '@message']
225
306
  @pack[:ivars][:@log]['ivars']['@message'].should == "Hello World! This is a log entry"
226
307
  end
@@ -233,7 +314,7 @@ describe Aqua::Pack do
233
314
  arrayish = Arrayed['a', 'b', 'c', 'd']
234
315
  arrayish.my_accessor = 'Newt'
235
316
  pack = arrayish._pack
236
- pack.keys.sort.should == ['class', 'init', 'ivars', 'keys']
317
+ pack.keys.should include('class', 'init', 'ivars')
237
318
  pack['init'].class.should == Array
238
319
  pack['init'].should == ['a', 'b', 'c', 'd']
239
320
  pack['ivars']['@my_accessor'].should == 'Newt'
@@ -248,7 +329,7 @@ describe Aqua::Pack do
248
329
  hashish['1'] = '2'
249
330
  hashish.my_accessor = 'Newt'
250
331
  pack = hashish._pack
251
- pack.keys.sort.should == ['class', 'init', 'ivars', 'keys']
332
+ pack.keys.should include('class', 'init', 'ivars')
252
333
  pack['init'].class.should == HashWithIndifferentAccess
253
334
  pack['init'].should == {'1' => '2'}
254
335
  pack['ivars']['@my_accessor'].should == 'Newt'
@@ -0,0 +1,52 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require_fixtures
3
+
4
+ Aqua.set_storage_engine('CouchDB') # to initialize CouchDB
5
+ CouchDB = Aqua::Store::CouchDB unless defined?( CouchDB )
6
+
7
+ describe Aqua::Stub do
8
+ before(:each) do
9
+ @params = {
10
+ :id => 'my_great_id',
11
+ :class => 'Gerbilmiester',
12
+ :methods => {
13
+ :gerbil => true,
14
+ :bacon => 'chunky'
15
+ }
16
+ }
17
+ @stub = Aqua::Stub.new( @params )
18
+ end
19
+
20
+ describe 'initialization' do
21
+ it 'should initialize delegate with a TempStub' do
22
+ delegate = @stub.instance_eval( "__getobj__" )
23
+ delegate.class.should == Aqua::TempStub
24
+ end
25
+
26
+ it 'should initialize the delegate_id' do
27
+ @stub.instance_eval('delegate_id').should == 'my_great_id'
28
+ end
29
+
30
+ it 'should initialize the delegate_class' do
31
+ @stub.instance_eval('delegate_class').should == 'Gerbilmiester'
32
+ end
33
+ end
34
+
35
+ describe 'delegation' do
36
+ it 'should return correct values for initialized methods' do
37
+ @stub.gerbil.should == true
38
+ @stub.bacon.should == 'chunky'
39
+ end
40
+
41
+ it 'should try to retrieve an object if an unspecified method is called' do
42
+ Gerbilmiester.should_receive(:load).and_return( Gerbilmiester.new )
43
+ @stub.herd
44
+ end
45
+
46
+ it 'should return correct values for new delegate' do
47
+ Gerbilmiester.should_receive(:load).and_return( Gerbilmiester.new )
48
+ @stub.herd.should == 'Yah, yah, little gerbil'
49
+ end
50
+ end
51
+
52
+ end
@@ -27,7 +27,10 @@ describe Aqua::Tank do
27
27
  Log.new.should respond_to(:commit)
28
28
  end
29
29
 
30
- it 'should add unpack methods to the class and its instances'
30
+ it 'should add unpack methods to the class and its instances' do
31
+ Log.should respond_to( :load )
32
+ Log.new.should respond_to( :reload )
33
+ end
31
34
 
32
35
  it 'should add configuration methods to the class' do
33
36
  Log.should respond_to(:configure_aqua)
@@ -38,14 +41,17 @@ describe Aqua::Tank do
38
41
 
39
42
  describe 'including Aqua::Pack on the class' do
40
43
  it 'should add pack methods to the class and its instances' do
41
- User.should respond_to(:hide_attributes)
42
- User.new.should respond_to(:commit)
44
+ Persistent.should respond_to(:hide_attributes)
45
+ Persistent.new.should respond_to(:commit)
43
46
  end
44
47
 
45
- it 'should add unpack methods to the class and its instances'
48
+ it 'should add unpack methods to the class and its instances' do
49
+ Persistent.should respond_to( :load )
50
+ Persistent.new.should respond_to( :reload )
51
+ end
46
52
 
47
53
  it 'should add configuration methods to the class' do
48
- User.should respond_to(:configure_aqua)
54
+ Persistent.should respond_to( :configure_aqua )
49
55
  end
50
56
 
51
57
  it 'should add query methods to the class and its instances'
@@ -266,13 +266,51 @@ describe Aqua::Unpack do
266
266
  it 'should unpack an aquatic object' do
267
267
  @user.commit!
268
268
  @user.log.should == @log
269
- end
269
+ end
270
+
271
+ describe 'externally saved aquatic objects' do
272
+ before(:all) do
273
+ User.configure_aqua( :embed => {:stub => [:username, :name] } )
274
+ end
275
+
276
+ after(:all) do
277
+ User.configure_aqua( :embed => {:stub => :username } )
278
+ end
279
+
280
+ before(:each) do
281
+ @time2 = Time.now - 3600
282
+ @graeme = User.new(:username => 'graeme', :name => ['Graeme', 'Nelson'], :created_at => @time2 )
283
+ @user = User.new(
284
+ :username => 'kane',
285
+ :name => ['Kane', 'Baccigalupi'],
286
+ :dob => @date,
287
+ :created_at => @time,
288
+ :log => @log,
289
+ :password => 'my secret!',
290
+ :other_user => @graeme
291
+ )
292
+ @user.commit!
293
+ end
294
+
295
+ it 'should load a Stub' do
296
+ user = User.load(@user.id)
297
+ user.other_user.class.should == Aqua::Stub
298
+ end
299
+
300
+ it 'should retrieve cached methods' do
301
+ user = User.load(@user.id)
302
+ User.should_not_receive(:load)
303
+ user.other_user.username.should == 'graeme'
304
+ user.other_user.name.should == ['Graeme', 'Nelson']
305
+ end
306
+
307
+ it 'should retrieve the stubbed object when an additional method is required' do
308
+ user = User.load(@user.id)
309
+ user.other_user.created_at.to_s.should == @time2.to_s
310
+ end
311
+ end
270
312
 
271
313
  end
272
314
  end
273
-
274
- # object.reload is used by Object.load(id), so there isn't any need right now to test both since
275
- # Object.load tests both at once.
276
-
277
315
  end
278
316
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baccigalupi-aqua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kane Baccigalupi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-25 00:00:00 -07:00
12
+ date: 2009-08-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -80,6 +80,7 @@ files:
80
80
  - lib/aqua/object/extensions/validation.rb
81
81
  - lib/aqua/object/pack.rb
82
82
  - lib/aqua/object/query.rb
83
+ - lib/aqua/object/stub.rb
83
84
  - lib/aqua/object/tank.rb
84
85
  - lib/aqua/object/unpack.rb
85
86
  - lib/aqua/store/couch_db/couch_db.rb
@@ -95,12 +96,14 @@ files:
95
96
  - spec/object/config_spec.rb
96
97
  - spec/object/object_fixtures/array_udder.rb
97
98
  - spec/object/object_fixtures/canned_hash.rb
99
+ - spec/object/object_fixtures/gerbilmiester.rb
98
100
  - spec/object/object_fixtures/grounded.rb
99
101
  - spec/object/object_fixtures/log.rb
100
102
  - spec/object/object_fixtures/persistent.rb
101
103
  - spec/object/object_fixtures/user.rb
102
104
  - spec/object/pack_spec.rb
103
105
  - spec/object/query_spec.rb
106
+ - spec/object/stub_spec.rb
104
107
  - spec/object/tank_spec.rb
105
108
  - spec/object/unpack_spec.rb
106
109
  - spec/spec.opts
@@ -143,12 +146,14 @@ test_files:
143
146
  - spec/object/config_spec.rb
144
147
  - spec/object/object_fixtures/array_udder.rb
145
148
  - spec/object/object_fixtures/canned_hash.rb
149
+ - spec/object/object_fixtures/gerbilmiester.rb
146
150
  - spec/object/object_fixtures/grounded.rb
147
151
  - spec/object/object_fixtures/log.rb
148
152
  - spec/object/object_fixtures/persistent.rb
149
153
  - spec/object/object_fixtures/user.rb
150
154
  - spec/object/pack_spec.rb
151
155
  - spec/object/query_spec.rb
156
+ - spec/object/stub_spec.rb
152
157
  - spec/object/tank_spec.rb
153
158
  - spec/object/unpack_spec.rb
154
159
  - spec/spec_helper.rb