Sha256: e46d63bb18eae5553da68ac6d4d2af638405173d27745453ef2381c02fe2610a

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

require "librarian/error"
require "librarian/logger"
require "librarian/action/resolve"
require "librarian/mock/environment"
require "librarian/mock/source"

module Librarian
  describe Action::Resolve do

    let(:options) { {} }
    let(:spec) { Spec.new([], dependencies, []) }
    let(:env) { Librarian::Mock::Environment.new }
    let(:action) { described_class.new(env, options) }
    let(:source1) { Librarian::Mock::Source::Mock.new(env, "source1", {}) }
    let(:source2) { Librarian::Mock::Source::Mock.new(env, "source2", {}) }

    before do
      env.stub(:specfile => double(:read => spec))
    end

    describe "#run" do

      describe "behavior" do

        describe "merge duplicated dependencies" do
          let(:options) { {:force => true} }
          let(:dependency1) { Dependency.new('dependency_name', '1.0.0', source1) }
          let(:dependency2) { Dependency.new('dependency_name', '1.0.0', source2) }
          let(:dependencies) { [ dependency1, dependency2 ] }
          let(:manifest) do
            m = Manifest.new(source1, dependency1.name)
            m.version = '1.0.0'
            m.dependencies = []
            m
          end

          it "should merge duplicated dependencies" do
            Dependency.any_instance.stub(:manifests => [manifest])
            action.stub(:persist_resolution)
            resolution = action.run
            expect(resolution.dependencies).to eq([dependency2])
          end

        end

      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
librarianp-0.6.3 spec/unit/action/resolve_spec.rb
librarianp-0.6.2 spec/unit/action/resolve_spec.rb
librarianp-0.6.1 spec/unit/action/resolve_spec.rb
librarianp-0.6.0 spec/unit/action/resolve_spec.rb