Sha256: 627ceb54545f9ebd7aa6339b37f68674311c013c60db4295412e1b53a8dc2f92

Contents?: true

Size: 801 Bytes

Versions: 33

Compression:

Stored size: 801 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

module FieldRefSpec
	
	class Dad < RedisObject; end
	class Son < RedisObject; end
	
	describe RedisObject do
		
		before do
			RedisObject.store.flushdb
			@dad = Dad.create("daddy")
			@son = Son.create("sonny")
			@dad.stepson = @son
		end
		
		it "can store an object at  any field location" do
			
			@dad.stepson = @son
			
		end
		
		it "can get the object back by get" do
			
			@dad.get(:stepson).should be_a(Son)
			
		end
		
		it "can get the object back by bracket" do
			
			@dad[:stepson].should be_a(Son)
			
		end
		
		it "can get the object back by pseudo-getter" do
			
			@dad.stepson.should be_a(Son)
			
		end
		
		it "can get the object back after reload" do
			
			Dad.find(@dad.id).stepson.should be_a(Son)
			
		end
		
	end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
redis_object-1.5.1 spec/field_ref_spec.rb
redis_object-1.5.0 spec/field_ref_spec.rb
redis_object-1.4.9 spec/field_ref_spec.rb
redis_object-1.4.8 spec/field_ref_spec.rb
redis_object-1.4.7 spec/field_ref_spec.rb
redis_object-1.4.6 spec/field_ref_spec.rb
redis_object-1.4.5 spec/field_ref_spec.rb
redis_object-1.4.3 spec/field_ref_spec.rb
redis_object-1.4.2 spec/field_ref_spec.rb
redis_object-1.4.1 spec/field_ref_spec.rb
redis_object-1.4.0 spec/field_ref_spec.rb
redis_object-1.3.9 spec/field_ref_spec.rb
redis_object-1.3.8 spec/field_ref_spec.rb
redis_object-1.3.7 spec/field_ref_spec.rb
redis_object-1.3.6 spec/field_ref_spec.rb
redis_object-1.3.5 spec/field_ref_spec.rb
redis_object-1.3.4 spec/field_ref_spec.rb
redis_object-1.3.3 spec/field_ref_spec.rb
redis_object-1.3.2 spec/field_ref_spec.rb
redis_object-1.3.1b spec/field_ref_spec.rb