test/attr_encrypted_test.rb in symmetric-encryption-0.4.0 vs test/attr_encrypted_test.rb in symmetric-encryption-0.5.0

- old
+ new

@@ -25,16 +25,16 @@ class User < ActiveRecord::Base attr_encrypted :bank_account_number attr_encrypted :social_security_number - validates :encrypted_bank_account_number, :symmetric_encrypted => true - validates :encrypted_social_security_number, :symmetric_encrypted => true + validates :encrypted_bank_account_number, :symmetric_encryption => true + validates :encrypted_social_security_number, :symmetric_encryption => true end # Load Symmetric Encryption keys -Symmetric::Encryption.load!(File.join(File.dirname(__FILE__), 'config', 'symmetric-encryption.yml'), 'test') +SymmetricEncryption.load!(File.join(File.dirname(__FILE__), 'config', 'symmetric-encryption.yml'), 'test') # Initialize the database connection config_file = File.join(File.dirname(__FILE__), 'config', 'database.yml') raise "database config not found. Create a config file at: test/config/database.yml" unless File.exists? config_file @@ -42,14 +42,14 @@ raise("Environment 'test' not defined in test/config/database.yml") unless cfg User.establish_connection(cfg) # -# Unit Test for attr_encrypted and validation aspects of Symmetric::Encryption +# Unit Test for attr_encrypted and validation aspects of SymmetricEncryption # class AttrEncryptedTest < Test::Unit::TestCase - context 'the Symmetric::Encryption Library' do + context 'the SymmetricEncryption Library' do setup do @bank_account_number = "1234567890" @bank_account_number_encrypted = "L94ArJeFlJrZp6SYsvoOGA==\n" @@ -157,11 +157,11 @@ should "validate encrypted data" do assert_equal true, @user.valid? @user.encrypted_bank_account_number = '123' assert_equal false, @user.valid? - assert_equal ["must be a value encrypted using Symmetric::Encryption.encrypt"], @user.errors[:encrypted_bank_account_number] - @user.encrypted_bank_account_number = Symmetric::Encryption.encrypt('123') + assert_equal ["must be a value encrypted using SymmetricEncryption.encrypt"], @user.errors[:encrypted_bank_account_number] + @user.encrypted_bank_account_number = SymmetricEncryption.encrypt('123') assert_equal true, @user.valid? @user.bank_account_number = '123' assert_equal true, @user.valid? end \ No newline at end of file