Sha256: e231b9bfebd0b50cbf1ddb7a6ba10c3adc15492ffedd1b8dc23ad028444f0c23

Contents?: true

Size: 1.26 KB

Versions: 6477

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Ethon::Easy::Http::Patch do
  let(:easy) { Ethon::Easy.new }
  let(:url) { "http://localhost:3001/" }
  let(:params) { nil }
  let(:form) { nil }
  let(:patch) { described_class.new(url, {:params => params, :body => form}) }

  describe "#setup" do
    it "sets customrequest" do
      expect(easy).to receive(:customrequest=).with("PATCH")
      patch.setup(easy)
    end

    it "sets url" do
      patch.setup(easy)
      expect(easy.url).to eq(url)
    end

    context "when requesting" do
      let(:params) { {:a => "1&b=2"} }

      before do
        patch.setup(easy)
        easy.perform
      end

      it "returns ok" do
        expect(easy.return_code).to eq(:ok)
      end

      it "is a patch request" do
        expect(easy.response_body).to include('"REQUEST_METHOD":"PATCH"')
      end

      it "requests parameterized url" do
        expect(easy.effective_url).to eq("http://localhost:3001/?a=1%26b%3D2")
      end
 
      context "when url already contains params" do
        let(:url) { "http://localhost:3001/?query=here" }

        it "requests parameterized url" do
          expect(easy.effective_url).to eq("http://localhost:3001/?query=here&a=1%26b%3D2")
        end
      end
    end
  end
end

Version data entries

6,477 entries across 6,475 versions & 21 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/ethon-0.16.0/spec/ethon/easy/http/patch_spec.rb