Sha256: bd3627881847048ef8b8945139b7404bc67ee41408cd752ae406a9ee1046786f

Contents?: true

Size: 863 Bytes

Versions: 22

Compression:

Stored size: 863 Bytes

Contents

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

require 'redis_object/ext/sanitization'

module TriggerSpec
	
	class SensitiveObject < RedisObject
		
		include Seabright::Sanitization
		
		date :test
		bool :yay
		json :stuff
		
		named_sanitization :burn, :test, :yay
	end
	
	describe Seabright::Triggers do
		before do
			RedisObject.store.flushdb
			@secret = SensitiveObject.create(test: Time.now, yay: true, stuff: {test: "1"}, worthless: "yup", sup: "dawg")
		end
		
		it "can sanitize a field or two willy nilly" do
			
			@secret.stuff.should be_a(Hash)
			@secret.sanitize! :stuff, :sup
			@secret.stuff.should eq(nil)
			
		end
		
		it "can sanitize by name" do
			
			@secret.test.should_not eq(nil)
			@secret.yay.should eq(true)
			@secret.sanitize_by_name! :burn
			@secret.test.should eq(nil)
			@secret.yay.should eq(false)
			
		end
		
	end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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