Sha256: 8d1ae688407c249a235263064e15d093d0ad16a12c5d894db5d6df15a3d2b2ae

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe CFAdmin::ServiceBroker::Update do
  let(:fake_home_dir) { "#{SPEC_ROOT}/fixtures/fake_admin_dir" }
  stub_home_dir_with { fake_home_dir }

  let(:client) { build(:client) }

  let(:service_broker) { CFoundry::V2::ServiceBroker.new(nil, client) }

  before do
    CFAdmin::ServiceBroker::Update.client = client
    client.stub(:service_broker_by_name).with('cf-mysql').and_return(service_broker)
  end

  it "updates a service broker when arguments are provided on the command line" do
    service_broker.stub(:update!)

    cf %W[update-service-broker --broker cf-mysql --name cf-othersql --url http://other.cfapp.io --token secret2]

    service_broker.name.should == 'cf-othersql'
    service_broker.broker_url.should == 'http://other.cfapp.io'
    service_broker.token.should == 'secret2'

    service_broker.should have_received(:update!)
  end

  it "updates a service broker when no change arguments are provided" do
    service_broker.stub(:update!)

    stub_ask("Name").and_return("cf-othersql")
    stub_ask("URL").and_return("http://other.example.com")
    stub_ask("Token").and_return("token2")

    cf %W[update-service-broker cf-mysql]

    service_broker.name.should == 'cf-othersql'
    service_broker.broker_url.should == 'http://other.example.com'
    service_broker.token.should == 'token2'

    service_broker.should have_received(:update!)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cf-5.2.1.rc7 spec/admin/service_broker/update_spec.rb
cf-5.2.1.rc6 spec/admin/service_broker/update_spec.rb
cf-5.2.1.rc5 spec/admin/service_broker/update_spec.rb