Sha256: c9dce6b55e7f6248b900310b8144ab85c42f77396db79351e6b3ee1c7b862316
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'ostruct' require 'test/unit' require File.join(File.dirname(__FILE__),"..","lib","refcode.rb") class RefcodeTest < Test::Unit::TestCase SECRET = "686cb0461769ebed556f56bc88c956bfdf786646ab1920f58201723c557ccbaeb57112fd53302c06475e6e19a176ba617ee284b091d375858cb259e8578c620f" SALT = "dcc74de5efdab0d80b5d763f8a63bef3d37c7453ee45446fbbccd26648af8ca6a112576dafbf5475f3cd7b968703cc9e0682ee45b8b622045cec287908f536e8" def test_encoder_against_hash test_hash = { :channel => 'email', :record_id => 49203, :action => 'forward' } assert_equal test_hash, encode_and_decode(test_hash) end def test_encoder_against_string test_string = "secret referral data" assert_equal test_string, encode_and_decode(test_string) end def test_encoder_against_int assert_equal 4857, encode_and_decode(4857) end def test_encoder_against_open_struct test_struct = OpenStruct.new({:test => 42}) assert_equal test_struct, encode_and_decode(test_struct) end private def encoder @encoder ||= Refcode::Encoder.new do |e| e.secret = SECRET e.salt = SALT end end def encode_and_decode val encoder.decode(encoder.encode(val)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
refcode-0.0.1 | test/refcode_test.rb |