2021-06-13 01:04:49 +02:00
|
|
|
require "./spec_helper"
|
2021-06-16 00:42:01 +02:00
|
|
|
require "../src/crypto-secret/test"
|
2022-05-12 07:09:27 +02:00
|
|
|
require "../src/crypto-secret"
|
2021-06-16 00:42:01 +02:00
|
|
|
|
|
|
|
test_secret_class Crypto::Secret::Not
|
|
|
|
test_secret_class Crypto::Secret::Bidet
|
2022-05-12 07:09:27 +02:00
|
|
|
|
|
|
|
describe Crypto::Secret do
|
|
|
|
it ".for" do
|
|
|
|
[:kgk, :key, :data, :not].each do |sym|
|
2022-05-20 22:02:16 +02:00
|
|
|
secret = Crypto::Secret.for 2, sym
|
2022-05-12 07:09:27 +02:00
|
|
|
secret.bytesize.should eq 2
|
|
|
|
end
|
|
|
|
end
|
2022-05-20 22:02:16 +02:00
|
|
|
|
|
|
|
it ".for fallback" do
|
|
|
|
secret = Crypto::Secret.for 2, :a, :b, :not
|
|
|
|
secret.bytesize.should eq 2
|
|
|
|
end
|
|
|
|
|
|
|
|
it ".for missing" do
|
|
|
|
expect_raises(KeyError) do
|
|
|
|
Crypto::Secret.for 2, :a
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it ".random" do
|
|
|
|
secret = Crypto::Secret.random 2, :a, :b, :not
|
|
|
|
secret.bytesize.should eq 2
|
|
|
|
end
|
2022-05-12 07:09:27 +02:00
|
|
|
end
|