Sha256: 2f2e0e400d44c3d2c27f1c18086fab167f4d8ef4fa25911c19d469cde84a0628

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require "./helpers"

describe "Start#target" do
  it "shows target url with no arguments" do
    shell("target").rstrip.should == client.target
  end

  describe "switching target url" do
    before(:all) do
      @old_target = File.read(File.expand_path(VMC::TARGET_FILE))
    end

    after(:all) do
      File.open(File.expand_path(VMC::TARGET_FILE), "w") do |io|
        io.print @old_target
      end
    end

    before(:each) do
      @old_client = client
    end

    after(:each) do
      VMC::CLI.client = @old_client
    end

    it "switches target url if given one argument" do
      shell("target", "http://api.cloudfoundry.com")
      client.target.should == "http://api.cloudfoundry.com"
    end

    it "defaults to https if supported by remote" do
      shell("target", "api.cloudfoundry.com")
      client.target.should == "https://api.cloudfoundry.com"
    end

    # TODO: this assumes locally running cc without https support
    it "defaults to http if not supported by remote" do
      base_target = client.target.sub(/^https?:\/\//, "")
      shell("target", base_target)
      client.target.should == "http://#{base_target}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vmc-0.4.0.beta.29 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.28 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.27 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.26 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.25 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.24 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.23 vmc-ng/spec/start/target_spec.rb
vmc-0.4.0.beta.22 vmc-ng/spec/start/target_spec.rb