Sha256: cced70b364218bf090a6b1dbfdec15b4b44e65666c902af8f363913426d9b647
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
require "test_helper" class ParselTest < Minitest::Test let(:key) { "my secret key" } test "encrypts data" do refute_equal "hello", Parsel.encrypt(key, "hello") end test "decrypts data" do encrypted = Parsel.encrypt(key, "hello") assert_equal "hello", Parsel.decrypt(key, encrypted) end test "returns false when decryption fails" do refute Parsel.decrypt("abc", "123") end test "uses custom iv" do iv = SecureRandom.hex(100) encrypted = Parsel.encrypt(key, iv, "hello") assert_equal "hello", Parsel.decrypt(key, iv, encrypted) end test "return false when decryption for custom iv fails" do iv = SecureRandom.hex(100) encrypted = Parsel.encrypt(key, iv, "hello") refute Parsel.decrypt(key, encrypted) end test "changes global iv" do iv = SecureRandom.hex(100) Parsel.default_iv = iv encrypted = Parsel.encrypt(key, "hello") assert_equal "hello", Parsel.decrypt(key, iv, encrypted) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
parsel-1.0.0 | test/parsel/parsel_test.rb |