Sha256: c8ebf4cc7a8169546e5072b3b2184d7433e130acc0c0356c5db7af3d629e0749

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require "spec_helper"

module CFoundry
  module V2
    describe User do
      let(:client) { build(:client) }
      subject { build(:user, client: client) }

      describe '#delete!' do
        describe 'when cloud controller was able to delete the user' do
          before do
            stub_request(:delete, /v2\/users\/.*/).to_return(:status => 200, :body => "", :headers => {})
            client.base.stub(:info).and_return({:authorization_endpoint => 'some_endpoint'})
          end

          it "also removes the user from uaa" do
            CFoundry::UAAClient.any_instance.should_receive(:delete_user)

            subject.delete!
          end
        end

        describe "when cloud controller was unable to delete the user" do
          before do
            client.base.stub(:delete).and_raise(CFoundry::APIError)
          end

          it "allows the exception to bubble up" do
            expect{ subject.delete! }.to raise_error(CFoundry::APIError)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cfoundry-2.3.4 spec/cfoundry/v2/user_spec.rb
cfoundry-2.3.3 spec/cfoundry/v2/user_spec.rb
cfoundry-2.3.2 spec/cfoundry/v2/user_spec.rb