Sha256: 3246b3a0d42d349d6bf055b6e77f4304412afbf778f8f3b314b5bb932b746647

Contents?: true

Size: 694 Bytes

Versions: 4

Compression:

Stored size: 694 Bytes

Contents

# encoding: UTF-8

require 'vines'
require 'minitest/autorun'

class KitTest < MiniTest::Unit::TestCase
  def test_hmac
    assert_equal 128, Vines::Kit.hmac('secret', 'username').length
    assert_equal Vines::Kit.hmac('s1', 'u1'), Vines::Kit.hmac('s1', 'u1')
    refute_equal Vines::Kit.hmac('s1', 'u1'), Vines::Kit.hmac('s2', 'u1')
    refute_equal Vines::Kit.hmac('s1', 'u1'), Vines::Kit.hmac('s1', 'u2')
  end

  def test_uuid
    ids = Array.new(1000) { Vines::Kit.uuid }
    assert ids.all? {|id| !id.nil? }
    assert ids.all? {|id| id.length == 36 }
    assert ids.all? {|id| id.match(/\w{8}-\w{4}-[4]\w{3}-[89ab]\w{3}-\w{12}/) }
    assert_equal ids.length, ids.uniq.length
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vines-0.3.0 test/kit_test.rb
vines-0.2.1 test/kit_test.rb
vines-0.2.0 test/kit_test.rb
vines-0.1.1 test/kit_test.rb