Sha256: c0880fa7d5e691c32bbf8fc4f26cac2708c803b81661886c0604453eebd346e7

Contents?: true

Size: 452 Bytes

Versions: 1

Compression:

Stored size: 452 Bytes

Contents

require "test_helper"

class JsonTest < Minitest::Test
  let(:key) { "my secret key" }

  test "encrypts data" do
    refute_equal JSON.dump(["hello"]), Parsel::JSON.encrypt(key, ["hello"])
  end

  test "decrypts data" do
    encrypted = Parsel::JSON.encrypt(key, ["hello"])
    assert_equal ["hello"], Parsel::JSON.decrypt(key, encrypted)
  end

  test "returns false when decryption fails" do
    refute Parsel::JSON.decrypt("abc", "123")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parsel-1.0.0 test/parsel/json_test.rb