Sha256: bbf94a30177c2216bd7225cdf0262d1a1418085145a5b83dc172950919e8861f

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

require 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

1 entries across 1 versions & 1 rubygems

Version Path
encrypted_strings-0.0.4 test/sha_encryptor_test.rb