Sha256: 49a816094d89d957dc9cffa35df2b92bb03cb7d2011820220f1509409f6016fa

Contents?: true

Size: 1.75 KB

Versions: 5

Compression:

Stored size: 1.75 KB

Contents

require "spec_helper"

module LicenseFinder
  describe Configuration do
    describe ".with_optional_saved_config" do
      it "should init and use saved config" do
        subject = described_class.with_optional_saved_config({}, fixture_path("."))
        expect(subject.gradle_command).to eq('gradlew')
      end
    end

    describe "gradle_command" do
      it "prefers primary value" do
        subject = described_class.new(
          {gradle_command: "primary"},
          {"gradle_command" => "secondary"}
        )
        expect(subject.gradle_command).to eq "primary"
      end

      it "accepts saved value" do
        subject = described_class.new(
          {gradle_command: nil},
          {"gradle_command" => "secondary"}
        )
        expect(subject.gradle_command).to eq "secondary"
      end

      it "has default" do
        subject = described_class.new(
          {gradle_command: nil},
          {"gradle_command" => nil}
        )
        expect(subject.gradle_command).to eq "gradle"
      end
    end

    describe "decisions_file" do
      it "prefers primary value" do
        subject = described_class.new(
          {decisions_file: "primary"},
          {"decisions_file" => "secondary"}
        )
        expect(subject.decisions_file.to_s).to eq "primary"
      end

      it "accepts saved value" do
        subject = described_class.new(
          {decisions_file: nil},
          {"decisions_file" => "secondary"}
        )
        expect(subject.decisions_file.to_s).to eq "secondary"
      end

      it "has default" do
        subject = described_class.new(
          {decisions_file: nil},
          {"decisions_file" => nil}
        )
        expect(subject.decisions_file.to_s).to eq "doc/dependency_decisions.yml"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
license_finder-2.0.4 spec/lib/license_finder/configuration_spec.rb
license_finder-2.0.3 spec/lib/license_finder/configuration_spec.rb
license_finder-2.0.2 spec/lib/license_finder/configuration_spec.rb
license_finder-2.0.1 spec/lib/license_finder/configuration_spec.rb
license_finder-2.0.0 spec/lib/license_finder/configuration_spec.rb