Sha256: 0f7e980db91005e6f9dd1855038897bda41a24a8a3a14298dffe665d92c859b1

Contents?: true

Size: 1.09 KB

Versions: 21

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
require 'net/http'
require 'uri'

describe CcApiStub::SpaceUsers do
  let(:url) { "http://example.com/v2/spaces/123/users/94087" }

  describe ".succeed_to_delete" do
    subject { CcApiStub::SpaceUsers.succeed_to_delete }

    it_behaves_like "a stubbed delete request"

    context "when the :roles option is provided" do
      let(:roles) { [:developer, :managers, :auditor] }
      it "deletes the user from each specified role" do
        CcApiStub::SpaceUsers.succeed_to_delete(roles: roles)
        roles.each do |role|
          url = "http://example.com/v2/spaces/123/#{role.to_s.pluralize}/94087"
          uri = URI.parse(url)
          Net::HTTP.start(uri.host, uri.port) do |http|
            request = Net::HTTP::Delete.new(url)
            response = http.request(request)
            check_response(response, code: 200, ignore_response: true)
          end
        end
      end
    end
  end

  describe ".fail_to_delete" do
    subject { CcApiStub::SpaceUsers.fail_to_delete }

    it_behaves_like "a stubbed delete request", :code => 500, :ignore_response => true
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
new_cfoundry-4.9.4 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.9.3 spec/cc_api_stub/space_users_spec.rb
ncfoundry-4.9.4 spec/cc_api_stub/space_users_spec.rb
ncfoundry-4.9.3 spec/cc_api_stub/space_users_spec.rb
ncfoundry-4.9.2 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.9.2 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.9.1 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.9.0 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.8.3 spec/cc_api_stub/space_users_spec.rb
new_cfoundry-4.8.2 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.7.2.rc1 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.7.1 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.7.1.rc1 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.7.0 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.3.rc3 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.3.rc2 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.3.rc1 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.2 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.1 spec/cc_api_stub/space_users_spec.rb
cfoundry-4.6.0 spec/cc_api_stub/space_users_spec.rb