Sha256: 73377935863b1df8eb517c029ceff6bd013269913abe557521db0347570995a0

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

########################################################################
# test_crypt_fog.rb
#
# Test suite for the crypt-fog library. You should run the 'test' rake
# task to run this test suite.
########################################################################
require 'test/unit'
require 'crypt/fog'

class TC_Fog < Test::Unit::TestCase
  def setup
    @fog = Crypt::Fog.new('hello')
  end

  def test_crypt_fog_version
    assert_equal('1.0.3', Crypt::Fog::VERSION)
    assert_true(Crypt::Fog::VERSION.frozen?)
  end

  def test_crypt_fog_constructor_one_argument_form
    assert_nothing_raised{ Crypt::Fog.new('string') }
    assert_kind_of(String, Crypt::Fog.new('string'))
  end

  def test_crypt_fog_constructor_two_argument_form
    assert_nothing_raised{ Crypt::Fog.new('string', 55) }
    assert_kind_of(String, Crypt::Fog.new('string', 55))
  end

  def test_class_decrypt
    assert_respond_to(Crypt::Fog, :decrypt)
    assert_nothing_raised{ Crypt::Fog.decrypt('string') }
    assert_nothing_raised{ Crypt::Fog.decrypt('string', 66) }
    assert_equal('hello', Crypt::Fog.decrypt(';8??B', 2003))
  end

  def test_instance_decrypt
    assert_respond_to(@fog, :decrypt)
    assert_nothing_raised{ @fog.decrypt }
    assert_equal('hello', @fog.decrypt)
  end

  def test_types
    assert_kind_of(Crypt::Fog, @fog)
    assert_kind_of(String, @fog.decrypt)
  end

  def teardown
    @fog = nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crypt-fog-1.0.3 test/test_crypt_fog.rb