Sha256: 14eda8853f535facfe9cf7cd739d7144b05663420a350c49983c030354147361

Contents?: true

Size: 911 Bytes

Versions: 3

Compression:

Stored size: 911 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class ShaEncryptorTest < Test::Unit::TestCase
  def setup
    PluginAWeek::EncryptedStrings::ShaEncryptor.default_salt = 'salt'
  end
  
  def test_should_encrypt_with_default_salt_if_salt_not_specified
    assert_equal 'f438229716cab43569496f3a3630b3727524b81b', PluginAWeek::EncryptedStrings::ShaEncryptor.new.encrypt('test')
  end
  
  def test_should_encrypt_with_custom_salt_if_salt_specified
    assert_equal '18e3256d71529db8fa65b2eef24a69ddad7070f3', PluginAWeek::EncryptedStrings::ShaEncryptor.new(:salt => 'different salt').encrypt('test')
  end
  
  def test_should_not_be_able_to_decrypt
    assert !PluginAWeek::EncryptedStrings::ShaEncryptor.new.can_decrypt?
  end
  
  def test_should_raise_exception_if_trying_to_decrypt
    assert_raises(NotImplementedError) { PluginAWeek::EncryptedStrings::ShaEncryptor.new.decrypt('test') }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
encrypted_strings-0.0.1 test/sha_encryptor_test.rb
encrypted_strings-0.0.3 test/sha_encryptor_test.rb
encrypted_strings-0.0.2 test/sha_encryptor_test.rb