Sha256: 53c3a4a3159c9379a8c5c8e0edc0e1217c6070566b69cfb1a1a7140a5fae0c6f

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require_relative '../../spec_helper'

describe AIPP::THash do
  context "non-circular dependencies" do
    subject do
      AIPP::THash[
        dns: %i(net),
        webserver: %i(dns logger),
        net: [],
        logger: []
      ]
    end

    describe :tsort do
      it "must compile the overall dependency list" do
        _(subject.tsort).must_equal %i(net dns logger webserver)
      end

      it "must compile partial dependency lists" do
        _(subject.tsort(:dns)).must_equal %i(net dns)
        _(subject.tsort(:logger)).must_equal %i(logger)
        _(subject.tsort(:webserver)).must_equal %i(net dns logger webserver)
      end
    end
  end

  context "circular dependencies" do
    subject do
      AIPP::THash[
        dns: %i(net),
        webserver: %i(dns logger),
        net: %i(dns),
        logger: []
      ]
    end

    describe :tsort do
      it "must raise cyclic dependency error" do
        _{ subject.tsort }.must_raise TSort::Cyclic
        _{ subject.tsort(:dns) }.must_raise TSort::Cyclic
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aipp-0.2.5 spec/lib/aipp/t_hash_spec.rb