Sha256: aff5870b13d49c9e5431d66e58f906bbe0b85cf96cdbacae1faef7269bbb9bf5

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

# encoding: utf-8

describe Attestor::Policy::Node do

  let(:policy_class)  { Attestor::Policy }
  let(:invalid_error) { Attestor::InvalidError }

  describe ".new" do

    it "creates a policy" do
      expect(subject).to be_kind_of policy_class
    end

    it "creates immutable object" do
      expect(subject).to be_frozen
    end

  end # describe .new

  describe "#branches" do

    let(:branches) { 3.times.map { double } }

    it "are initialized from list" do
      subject = described_class.new(*branches)
      expect(subject.branches).to match_array branches
    end

    it "are initialized from array" do
      subject = described_class.new(branches)
      expect(subject.branches).to match_array branches
    end

  end # describe #branches

  describe "#validate" do

    it "raises InvalidError" do
      expect { subject.validate }.to raise_error invalid_error
    end

  end # describe #validate

end # describe Attestor::Policy::Node

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attestor-0.3.0 spec/tests/policy/node_spec.rb
attestor-0.2.0 spec/tests/policy/node_spec.rb
attestor-0.1.0 spec/tests/policy/node_spec.rb
attestor-0.0.1 spec/tests/policy/node_spec.rb