add class to wrap sensitive values
This commit is contained in:
26
test/test_sensitive.rb
Normal file
26
test/test_sensitive.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require "minitest/autorun"
|
||||
|
||||
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
|
||||
|
||||
require "sensitive"
|
||||
|
||||
ALPHABET = ("a".."z").reduce(:concat)
|
||||
|
||||
class TestSensitive < Minitest::Test
|
||||
def setup
|
||||
@s = Sensitive.new ALPHABET
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
assert_equal @s.to_s, "ab" + "*" * 22 + "yz"
|
||||
end
|
||||
|
||||
def test_unwrap
|
||||
assert_equal @s.unwrap, ALPHABET
|
||||
end
|
||||
|
||||
def test_using_a_different_mask_character
|
||||
s = Sensitive.new ALPHABET, ch: "x"
|
||||
assert_equal s.to_s, "ab" + "x" * 22 + "yz"
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user