Sha256: 580447712674e946224a1cbe35c586faf7a1c7469e0cb6d75698376d8c000453

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

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

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

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

    it_behaves_like "a stubbed delete request"

    context "when the :roles option is provided" do
      let(:roles) { [:user, :managers, :auditor] }
      it "deletes the user from each specified role" do
        CcApiStub::OrganizationUsers.succeed_to_delete(roles: roles)
        roles.each do |role|
          url = "http://example.com/v2/organizations/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::OrganizationUsers.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/organization_users_spec.rb
new_cfoundry-4.9.3 spec/cc_api_stub/organization_users_spec.rb
ncfoundry-4.9.4 spec/cc_api_stub/organization_users_spec.rb
ncfoundry-4.9.3 spec/cc_api_stub/organization_users_spec.rb
ncfoundry-4.9.2 spec/cc_api_stub/organization_users_spec.rb
new_cfoundry-4.9.2 spec/cc_api_stub/organization_users_spec.rb
new_cfoundry-4.9.1 spec/cc_api_stub/organization_users_spec.rb
new_cfoundry-4.9.0 spec/cc_api_stub/organization_users_spec.rb
new_cfoundry-4.8.3 spec/cc_api_stub/organization_users_spec.rb
new_cfoundry-4.8.2 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.7.2.rc1 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.7.1 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.7.1.rc1 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.7.0 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.3.rc3 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.3.rc2 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.3.rc1 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.2 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.1 spec/cc_api_stub/organization_users_spec.rb
cfoundry-4.6.0 spec/cc_api_stub/organization_users_spec.rb