Sha256: 4a06d6b6d77ac247dc0905dfd8394d5d7184917b17cc0dd1fd03a2e2c25d4be9

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

module MavenPom
  describe Sorter do
    let(:poms) {
      [
        mock(Pom,
          :key => "no.finntech:control",
          :dependencies => ["no.finntech:kernel", "no.finntech:base"],
          :parent => nil
        ),
        mock(Pom,
          :key => "no.finntech:kernel",
          :dependencies => [],
          :parent => "no.finntech:iad"
        ),
        mock(Pom,
          :key => "no.finntech:base",
          :dependencies => ["no.finntech:kernel"],
          :parent => "no.finntech:iad"
        ),
        mock(Pom,
          :key => "no.finntech:iad",
          :dependencies => [],
          :parent => nil
        )
      ].each { |e| e.stub(:build_plugins => []) }
    }

    it "does a topological sort of the given maven modules" do
      sorted = Sorter.new(poms).sort.map { |e| e.key }

      sorted.should == [
        "no.finntech:iad",
        "no.finntech:kernel",
        "no.finntech:base",
        "no.finntech:control"
      ]
    end

    it "has a shortcut on the module" do
      MavenPom.sort(poms).should be_kind_of(Array)
    end

  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maven_pom-0.0.2 spec/sorter_spec.rb
maven_pom-0.0.1 spec/sorter_spec.rb