Sha256: 58b403bf145ca12b30cf46e87607597524511e915662448fc25bfca9d09bf51d

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

require "spec_helper"

describe "brightbox cloudips" do
  describe "map" do
    let(:output) { FauxIO.new { Brightbox.run(argv) } }
    let(:stdout) { output.stdout }
    let(:stderr) { output.stderr }

    before do
      config = config_from_contents(USER_APP_CONFIG_CONTENTS)

      # Setup in the VCR recordings
      cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
    end

    context "when destination is a server ID", vcr: true do
      let(:argv) { %w[cloudips map cip-12345 srv-12345] }
      let(:target) { "int-12345" }

      it "passes the interface identifier to the API" do
        expect_any_instance_of(Brightbox::CloudIP).to receive(:map).with(target).and_call_original
        expect(stdout).to include("mapped")
      end
    end

    context "when destination is another value", vcr: true do
      let(:target) { "res-12345" }
      let(:argv) { %w[cloudips map cip-12345 res-12345] }

      it "passes the identifier to the API" do
        expect_any_instance_of(Brightbox::CloudIP).to receive(:map).with(target)
        expect(stderr).to include(target)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
brightbox-cli-4.8.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.7.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.6.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.5.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.5.0.rc1 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.4.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.3.2 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.3.1 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.3.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.2.1 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.2.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.1.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.0.0 spec/commands/cloudips/map_spec.rb
brightbox-cli-4.0.0.rc2 spec/commands/cloudips/map_spec.rb