Sha256: 93b47beb3a0d10acc7930915f1c546396b81bd995ef38322c7fb5ea4f7b66668

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe NexusCli::RemoteFactory do
  subject { remote_factory }
  let(:remote_factory) { described_class }

  describe "::create" do
    subject { create }
    let(:create) { remote_factory.create(overrides) }

    before do
      NexusCli::Connection.stub(:new)
      remote_factory.stub(:running_nexus_pro?).and_return(false)
      NexusCli::OSSRemote.stub(:new)
    end

    context "when overrides are passed in" do
      let(:overrides) {
        {
          "url" => "http://somewebsite.com",
          "repository" => "foo",
          "username" => "admin",
          "password" => "password"
        }
      }

      it "loads configuration from the overrides" do
        NexusCli::Configuration.should_receive(:from_overrides).with(overrides)
        create
      end
    end

    context "when no overrides are passed in" do
      let(:overrides) { nil }

      it "loads configuration from the config file" do
        NexusCli::Configuration.should_receive(:from_file)
        create
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
nexus_cli_sb-4.0.4 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli_sb-4.0.2 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli_nx-4.1.2 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.1.1 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.1.0 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.0.3 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.0.2 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.0.1 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.0.0 spec/unit/nexus_cli/remote_factory_spec.rb
nexus_cli-4.0.0.beta1 spec/unit/nexus_cli/remote_factory_spec.rb