Sha256: 2b45c05ee3c64c68d8caf73ab8203223dd7e12b9fd2240b046c478cfe98466d5

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

module CFoundry
  module V2
    describe UserProvidedServiceInstance do
      let(:client) { build(:client) }
      subject { build(:user_provided_service_instance, :client => client) }

      describe 'space' do
        let(:space) { build(:space) }

        it 'has a space' do
          subject.space = space
          expect(subject.space).to eq(space)
        end

        context 'when an invalid value is assigned' do
          it 'raises a Mismatch exception' do
            expect {
              subject.space = [build(:organization)]
            }.to raise_error(CFoundry::Mismatch)
          end
        end
      end

      describe 'creating' do
        let(:body) {
          {
            'metadata' => {
              'guid' => 'someguid'
            }
          }.to_json
        }

        it 'calls the correct endpoint' do
          stub_request(:any, %r[.*]).
            to_return(:body => body, :status => 200)

          subject.create!

          a_request(:post, 'http://api.example.com/v2/user_provided_service_instances').should have_been_made
        end
      end

      describe 'deleting' do
        it 'calls the correct endpoint' do
          stub_request(:any, %r[.*])

          subject.delete!

          a_request(:delete, "http://api.example.com/v2/service_instances/#{subject.guid}").should have_been_made
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
cfoundry-4.7.2.rc1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.7.1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.7.1.rc1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.7.0 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.3.rc3 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.3.rc2 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.3.rc1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.2 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.6.0 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.5.3 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.5.2 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.5.1 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.5.0 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.12 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.11 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.10 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.9 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.8 spec/cfoundry/v2/user_provided_service_instance_spec.rb
cfoundry-4.3.7 spec/cfoundry/v2/user_provided_service_instance_spec.rb