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.3.1 spec/field_ref_spec.rb
redis_object-1.3.0 spec/field_ref_spec.rb
redis_object-1.2.9b spec/field_ref_spec.rb
redis_object-1.2.9 spec/field_ref_spec.rb
redis_object-1.2.8 spec/field_ref_spec.rb
redis_object-1.2.7 spec/field_ref_spec.rb
redis_object-1.2.6 spec/field_ref_spec.rb
redis_object-1.2.5 spec/field_ref_spec.rb
redis_object-1.2.4 spec/field_ref_spec.rb
redis_object-1.2.3 spec/field_ref_spec.rb
redis_object-1.2.2 spec/field_ref_spec.rb
redis_object-1.2.1 spec/field_ref_spec.rb
redis_object-1.2 spec/field_ref_spec.rb