Sha256: 615bb07531f5108194918f4105fdc921adb6c7ab55a6e5ae7626cfbbd0d08b36

Contents?: true

Size: 989 Bytes

Versions: 6

Compression:

Stored size: 989 Bytes

Contents

# encoding: utf-8

# describe #valid_policy and #invalid_policy builders
# also describes shared examples for all policies
require "support/policies"

describe Attestor::Policy::Xor do

  subject { described_class.new items }

  describe ".new" do

    let(:items) { [valid_policy] }

    it_behaves_like "creating a node"
    it_behaves_like "creating an immutable object"

  end # context

  describe "#validate" do

    context "when both valid and invalid parts exist" do

      let(:items) { [valid_policy, valid_policy, invalid_policy] }

      it_behaves_like "passing validation"

    end # context

    context "when all parts are valid" do

      let(:items) { 3.times.map { valid_policy } }

      it_behaves_like "failing validation"

    end # context

    context "when all parts are invalid" do

      let(:items) { 3.times.map { invalid_policy } }

      it_behaves_like "failing validation"

    end # context

  end # describe #validate

end # describe Policy::Base::Not

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
attestor-1.0.0 spec/tests/policy/xor_spec.rb
attestor-0.4.0 spec/tests/policy/xor_spec.rb
attestor-0.3.0 spec/tests/policy/xor_spec.rb
attestor-0.2.0 spec/tests/policy/xor_spec.rb
attestor-0.1.0 spec/tests/policy/xor_spec.rb
attestor-0.0.1 spec/tests/policy/xor_spec.rb