Sha256: 4445756696a46c49a11475748215d19589d24f0580e3bf000973bd586a6b9d7c

Contents?: true

Size: 1.23 KB

Versions: 45

Compression:

Stored size: 1.23 KB

Contents

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

45 entries across 44 versions & 8 rubygems

Version Path
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/spec/ethon/easy/http/patch_spec.rb