Sha256: 211c461a215c4862486d4fe0802683e613ee3232d1d227fc6f15a5a1083d52ab

Contents?: true

Size: 1.57 KB

Versions: 9

Compression:

Stored size: 1.57 KB

Contents

require "spec_helper"

module LicenseFinder
  describe Core do
    let(:options) { {} }
    let(:license_finder) { described_class.new(options) }
    let(:logger) { Logger.new(options[:logger]) }
    let(:configuration) { LicenseFinder::Configuration.new(options, {})}
    let(:pathname) { Pathname.pwd + Pathname(options[:project_path]) }

    before do
      allow(Logger).to receive(:new).and_return(logger)
    end

    describe "#unapproved" do
      let(:options) {
        {
          logger: {},
          project_path: 'other_directory',
          gradle_command: 'just_do_it',
          rebar_command: 'do_it',
          rebar_deps_dir: 'nowhere/deps'
        }
      }
      let(:package_options) {
        {
          logger: logger,
          project_path: configuration.project_path,
          ignore_groups: Set.new,
          go_full_version: nil,
          gradle_command: configuration.gradle_command,
          gradle_include_groups: nil,
          rebar_command: configuration.rebar_command,
          rebar_deps_dir: configuration.rebar_deps_dir
        }
      }

      it "delegates to the decision_applier" do
        decision_applier =  double(:decision_applier)
        allow(license_finder).to receive(:decision_applier).and_return(decision_applier)
        expect(decision_applier).to receive(:unapproved)
        license_finder.unapproved
      end

      it "passes through options when fetching current packages" do
        expect(PackageManager).to receive(:current_packages).with(package_options).and_return([])
        license_finder.unapproved
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
license_finder-2.1.2 spec/lib/license_finder/core_spec.rb
license_finder-2.1.1 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc9 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc8 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc7 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc6 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc5 spec/lib/license_finder/core_spec.rb
license_finder-2.1.0.rc4 spec/lib/license_finder/core_spec.rb