test/attr_encrypted_test.rb in symmetric-encryption-0.2.0 vs test/attr_encrypted_test.rb in symmetric-encryption-0.3.0

- old
+ new

@@ -7,30 +7,14 @@ require 'test/unit' require 'shoulda' require 'active_record' require 'symmetric-encryption' -# #TODO Need to supply the model and migrations for this test -# Adding to existing AR model User -# Unit Test for Symmetric::Encryption -# - -#ROOT = File.join(File.dirname(__FILE__), '..') - -#['/lib', '/db'].each do |folder| -# $:.unshift File.join(ROOT, folder) -#end - ActiveRecord::Base.logger = Logger.new($stderr) ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read('test/config/database.yml')).result) ActiveRecord::Base.establish_connection('test') -#ActiveRecord::Base.connection.create_database 'symmetric_encryption_test', :charset => :utf8 -#require 'db/schema' - -#The file db/schema.rb contains, for example: - ActiveRecord::Schema.define :version => 0 do create_table :users, :force => true do |t| t.string :encrypted_bank_account_number t.string :encrypted_social_security_number end @@ -42,10 +26,14 @@ validates :encrypted_bank_account_number, :symmetric_encrypted => true validates :encrypted_social_security_number, :symmetric_encrypted => true end +# +# Unit Test for attr_encrypted and validation aspects of Symmetric::Encryption +# + class AttrEncryptedTest < Test::Unit::TestCase context 'initialized' do setup do Symmetric::Encryption.load!(File.join(File.dirname(__FILE__), 'config', 'symmetric-encryption.yml'), 'test') @@ -64,13 +52,13 @@ context 'the Symmetric::Encryption Library' do setup do @bank_account_number = "1234567890" - @bank_account_number_encrypted = "QUxoUU8O/mi0o9ykgXNBFg==\n" + @bank_account_number_encrypted = "L94ArJeFlJrZp6SYsvoOGA==\n" @social_security_number = "987654321" - @social_security_number_encrypted = "Jj7dKb3B0aUCnqH/YKGvKw==\n" + @social_security_number_encrypted = "S+8X1NRrqdfEIQyFHVPuVA==\n" @user = User.new( # Encrypted Attribute :bank_account_number => @bank_account_number, # Encrypted Attribute \ No newline at end of file