Sha256: 4108605a6511c99bc3a4c0847a20480294c8e7a089b55367c2f9e9efd01c349f

Contents?: true

Size: 1.9 KB

Versions: 10

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

remote = NexusCli::OSSRemote.new({'url' => 'http://localhost:8081/nexus', 'repository' => 'releases', 'username' => 'admin', 'password' => 'admin123'})

describe NexusCli do
  it "gives you errors when you attempt to pull an artifact don't give a valid artifact name" do
    expect {remote.pull_artifact "com.something:something:1.0.0", nil}.to raise_error(NexusCli::ArtifactMalformedException)
  end

  it "gives you errors when you attempt to get an artifact's info and don't give a valid artifact name" do
    expect {remote.get_artifact_info "com.something:something:1.0.0"}.to raise_error(NexusCli::ArtifactMalformedException)
  end
  
  it "gives you errors when you attempt to pull an artifact and it cannot be found" do
    HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
    expect {remote.pull_artifact "com.something:something:1.0.0:tgz", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
  end

  it "gives you errors when you attempt to get an artifact's info and it cannot be found" do
    HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
    expect {remote.get_artifact_info "com.something:something:1.0.0:tgz"}.to raise_error(NexusCli::ArtifactNotFoundException)
  end

  it "gives you an error when you try to update a user that doesnt exist" do
    stub_request(:get, "http://admin:admin123@localhost:8081/nexus/service/local/users/qwertyasdf").
         with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
         to_return(:status => 404, :body => "", :headers => {})
    expect {remote.update_user(:userId => "qwertyasdf")}.to raise_error(NexusCli::UserNotFoundException)
  end

  it "gives you an error when you try to set the logging level to something weird" do
    expect {remote.set_logger_level("weird")}.to raise_error(NexusCli::InvalidLoggingLevelException)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nexus_cli-1.0.2 spec/oss_remote_spec.rb
nexus_cli-1.0.1 spec/oss_remote_spec.rb
nexus_cli-1.0.0 spec/oss_remote_spec.rb
nexus_cli-0.9.1 spec/oss_remote_spec.rb
nexus_cli-0.9.0 spec/oss_remote_spec.rb
nexus_cli-0.8.4 spec/oss_remote_spec.rb
nexus_cli-0.8.3 spec/oss_remote_spec.rb
nexus_cli-0.8.2 spec/oss_remote_spec.rb
nexus_cli-0.8.1 spec/oss_remote_spec.rb
nexus_cli-0.8.0 spec/oss_remote_spec.rb