Sha256: de4451c75360742a24830f5045d25a8e9c2803ff37df64084b99b14a6b38c922

Contents?: true

Size: 1.52 KB

Versions: 16

Compression:

Stored size: 1.52 KB

Contents

require "spec_helper"

module LicenseFinder
  module CLI
    describe Blacklist do
      let(:decisions) { Decisions.new }

      before do
       allow(Decisions).to receive(:fetch_saved) { decisions }
      end

      describe "list" do
        it "shows the blacklist of licenses" do
          decisions.blacklist("MIT")

          expect(capture_stdout { subject.list }).to match /MIT/
        end
      end

      describe "add" do
        it "adds the specified license to the blacklist" do
          silence_stdout do
            subject.add("test")
          end
          expect(subject.decisions.blacklisted).to eq [License.find_by_name("test")].to_set
        end

        it "adds multiple licenses to the blacklist" do
          silence_stdout do
            subject.add("test", "rest")
          end
          expect(subject.decisions.blacklisted).to eq [
            License.find_by_name("test"),
            License.find_by_name("rest")
          ].to_set
        end
      end

      describe "remove" do
        it "removes the specified license from the blacklist" do
          silence_stdout do
            subject.add("test")
            subject.remove("test")
          end
          expect(subject.decisions.blacklisted).to be_empty
        end

        it "removes multiple licenses from the blacklist" do
          silence_stdout do
            subject.add("test", "rest")
            subject.remove("test", "rest")
          end
          expect(subject.decisions.blacklisted).to be_empty
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
license_finder-3.0.4 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-3.0.2 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-3.0.1 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-3.0.0 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.2 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.1 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc9 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc8 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc7 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc6 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc5 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc4 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc3 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc2 spec/lib/license_finder/cli/blacklist_spec.rb
license_finder-2.1.0.rc1 spec/lib/license_finder/cli/blacklist_spec.rb