Sha256: 32dc1bd534ba60f78d57aafd5047ee81a00eefa10b955eaa0e9ebda4ce25725e

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'axel/request_options'
module Axel
  describe RequestOptions do
    subject { RequestOptions.new nil, example_options }
    let(:example_options) { {} }

    it "compiles with the default headers" do
      subject.compiled.should == {
        'headers' => {
          'Content-Type' => 'application/json'
        },
      }
    end

    describe "non-conflicting params" do
      let(:example_options) { { params: { id: 1 } } }
      it "compiles with the non-conflicting params" do
        subject.compiled.should == {
          'params' => { 'id' => 1 },
          'headers' => {
            'Content-Type' => 'application/json'
          },
        }
      end
    end

    describe "slightly-conflicting params" do
      let(:example_options) { { headers: { id: 1 } } }
      it "compiles with the non-conflicting params" do
        subject.compiled.should == {
          'headers' => {
            'id' => 1,
            'Content-Type' => 'application/json'
          },
        }
      end
    end

    describe "truly-conflicting params" do
      let(:example_options) { { headers: { "Content-Type" => 1 } } }
      it "compiles with the non-conflicting params" do
        subject.compiled.should == {
          'headers' => {
            'Content-Type' => 1
          },
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axel-0.0.1 spec/lib/axel/request_options_spec.rb