Sha256: 025b302c63488573c242bda35b69772c9cf22ca67adafd8c92d3a40d6a9826cb

Contents?: true

Size: 636 Bytes

Versions: 5

Compression:

Stored size: 636 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(Exception)
    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

5 entries across 5 versions & 1 rubygems

Version Path
rbnacl-3.1.0 spec/rbnacl/secret_box_spec.rb
rbnacl-3.0.1 spec/rbnacl/secret_box_spec.rb
rbnacl-3.0.0 spec/rbnacl/secret_box_spec.rb
rbnacl-2.0.0 spec/rbnacl/secret_box_spec.rb
rbnacl-2.0.0.pre spec/rbnacl/secret_box_spec.rb