Sha256: 12c72fa5a99146a7fdb2284e2364646bdd0b76a3f120014c6ad3d937b58bf909

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

module LicenseFinder
  describe CLI do
    describe "#execute!(options)" do
      before { CLI.stub(:check_for_action_items) }

      context "when the approve option is provided" do
        it "should approve the requested gem" do
          dependency = double('dependency', :name => nil)
          dependency.should_receive(:approve!)

          Dependency.stub(:first).with(name: 'foo').and_return(dependency)

          CLI.execute! approve: true, dependency: 'foo'
        end
      end

      context "when the -l (--license) switch is provided" do
        it "should update the license on the requested gem" do
          dependency = double :dependency, :name => nil
          dependency.should_receive(:set_license_manually).with("foo")

          Dependency.stub(:first).with(name: "foo_gem").and_return dependency

          CLI.execute! license: "foo", dependency: 'foo_gem'
        end
      end

      context "when no options are provided" do
        it "should check for action items" do
          CLI.should_receive(:check_for_action_items)
          CLI.execute!
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
license_finder-0.8.1-java spec/lib/license_finder/cli_spec.rb
license_finder-0.8.1 spec/lib/license_finder/cli_spec.rb
license_finder-0.8.0-java spec/lib/license_finder/cli_spec.rb
license_finder-0.8.0 spec/lib/license_finder/cli_spec.rb