Sha256: 7cc2c875660d0878365ce4a880c18f5463d645cfa82902a15ab41954fbbc1093

Contents?: true

Size: 1.02 KB

Versions: 22

Compression:

Stored size: 1.02 KB

Contents

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

module DumpingSpec
	
	class DumpableObject < RedisObject
		
		int :phone
		bool :mailed
		date :canceled_at
				
	end
	
	class GenericObject < RedisObject
		
		json :complex
		
	end
	
	describe Seabright::Triggers do
		before do
			RedisObject.store.flushdb
			5.times do
				d = DumpableObject.create(phone: Random.rand(100)*555, mailed: true, canceled_at: Time.now)
				d << GenericObject.create(complex: {woot: true, ohnoes: false})
			end
		end
		
		it "can dump an object" do
			
			r = DumpableObject.latest.to_yaml
			r.size.should > 100
			
		end
		
		it "can dump to json" do
			
			r = DumpableObject.latest.to_json
			r.size.should > 100
			
		end
		
		it "can dump errthing" do
			
			r = RedisObject.dump_everything
			r.size.should > 100
			
		end
		
		it "can load back in a dump" do
			
			r = RedisObject.dump_everything
			r.size.should > 100
			RedisObject.store.flushdb
			RedisObject.load_dump r
			DumpableObject.latest.generic_objects.count.should eq(1)
			
		end
		
	end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
redis_object-1.4.3 spec/dumping_spec.rb
redis_object-1.4.2 spec/dumping_spec.rb
redis_object-1.4.1 spec/dumping_spec.rb
redis_object-1.4.0 spec/dumping_spec.rb
redis_object-1.3.9 spec/dumping_spec.rb
redis_object-1.3.8 spec/dumping_spec.rb
redis_object-1.3.7 spec/dumping_spec.rb
redis_object-1.3.6 spec/dumping_spec.rb
redis_object-1.3.5 spec/dumping_spec.rb
redis_object-1.3.4 spec/dumping_spec.rb
redis_object-1.3.3 spec/dumping_spec.rb
redis_object-1.3.2 spec/dumping_spec.rb
redis_object-1.3.1b spec/dumping_spec.rb
redis_object-1.3.1 spec/dumping_spec.rb
redis_object-1.3.0 spec/dumping_spec.rb
redis_object-1.2.9b spec/dumping_spec.rb
redis_object-1.2.9 spec/dumping_spec.rb
redis_object-1.2.8 spec/dumping_spec.rb
redis_object-1.2.7 spec/dumping_spec.rb
redis_object-1.2.6 spec/dumping_spec.rb