Sha256: 382f6c1a2e7938d3d54be3ca31c7f445ba6414b6d1ca12debe3db86358856d04

Contents?: true

Size: 625 Bytes

Versions: 1

Compression:

Stored size: 625 Bytes

Contents

# encoding: binary
require 'spec_helper'

describe RbNaCl::SecretBox do
  let (:key) { vector :secret_key }

  context "new" do
    it "accepts strings" do
      expect { RbNaCl::SecretBox.new(key) }.to_not raise_error
    end

    it "raises on a nil key" do
      expect { RbNaCl::SecretBox.new(nil) }.to raise_error(TypeError)
    end

    it "raises on a short key" do
      expect { RbNaCl::SecretBox.new("hello") }.to raise_error(RbNaCl::LengthError, "Secret key was 5 bytes \(Expected #{RbNaCl::SecretBox::KEYBYTES}\)")
    end
  end

  include_examples "box" do
    let(:box) { RbNaCl::SecretBox.new(key) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbnacl-3.1.1 spec/rbnacl/secret_box_spec.rb