Sha256: 3a1a17176445f5d1febcfed4e592f0b2e6ef1da6c8aa80371583733dac252a79
Contents?: true
Size: 1.39 KB
Versions: 10
Compression:
Stored size: 1.39 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! expect(a_request(:post, 'http://api.example.com/v2/user_provided_service_instances')).to have_been_made end end describe 'deleting' do it 'calls the correct endpoint' do stub_request(:any, %r[.*]) subject.delete! expect(a_request(:delete, "http://api.example.com/v2/service_instances/#{subject.guid}")).to have_been_made end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems