Sha256: 8e6be26ac1efc5efafd9f9d9d2c9289e6642b001584de60694e6bc880ffd56d2

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8

describe Policy::Follower::ViolationError do

  let(:errors)   { double :errors   }
  let(:follower) { double :follower }
  let(:policy)   { double :policy, errors: errors }
  subject        { described_class.new follower, policy }

  describe ".new" do

    it "creates the RuntimeError" do
      expect(subject).to be_kind_of ::RuntimeError
    end

  end # describe .new

  describe "#follower" do

    it "is initialized" do
      expect(subject.follower).to eq follower
    end

  end # describe #follower

  describe "#policy" do

    it "is initialized" do
      expect(subject.policy).to eq policy
    end

  end # describe #policy

  describe "#errors" do

    it "is initialized" do
      expect(subject.errors).to eq errors
    end

  end # describe #errors

  describe "#message" do

    it "returns a correct string" do
      expect(subject.message)
        .to eq "#{ follower.inspect } violates the policy #{ policy }"
    end

  end # describe #message

  describe "#inspect" do

    it "returns a correct string" do
      expect(subject.inspect)
        .to eq "#<#{ described_class.name }: #{ subject.message }>"
    end

  end # describe #inspect

end # describe Policy::Follower::NameError

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
policy-2.0.0 spec/tests/lib/policy/follower/violation_error_spec.rb