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