Sha256: cf295b71fef56ee742e95fdb5146133e2fd8f11a5c593d6beb392efca5d10c77

Contents?: true

Size: 858 Bytes

Versions: 9

Compression:

Stored size: 858 Bytes

Contents

require 'spec_helper'

describe VersionCake::ResponseStrategy::HttpContentTypeStrategy do
  describe '#execute' do
    let(:headers) { { 'Content-Type' => 'application/json' } }
    let(:context) { double('content', version: 4) }
    before do
      VersionCake::ResponseStrategy::HttpContentTypeStrategy.new.execute(
          context, nil, headers, nil
      )
    end

    it { expect(headers['Content-Type']).to eq 'application/json; api_version=4' }

    context 'for a header that ends in a semi colon' do
      let(:headers) { { 'Content-Type' => 'application/vnd.api+json; charset=utf-8;' } }

      it { expect(headers['Content-Type']).to eq 'application/vnd.api+json; charset=utf-8; api_version=4' }
    end

    context 'when there is no content type' do
      let(:headers) { {} }

      it { expect(headers.empty?).to eq true }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
versioncake-4.1.1 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-4.1.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-4.0.2 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-4.0.1 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-4.0.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-3.4.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-3.3.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-3.2.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb
versioncake-3.1.0 spec/unit/response_strategy/http_content_type_strategy_spec.rb