Sha256: 4c276ca4f6cc6e25ab1f3710a1f84bae6a2f7c59acf76fe1f1e17d44d8c94838

Contents?: true

Size: 606 Bytes

Versions: 10

Compression:

Stored size: 606 Bytes

Contents

require 'spec_helper'

describe VersionCake::HttpHeaderStrategy do
  let(:strategy) { VersionCake::HttpHeaderStrategy.new }
  subject { strategy.extract(request) }

  context "a request with an HTTP_X_API_VERSION retrieves the version" do
    let(:request) { instance_double('Request', env: {'HTTP_API_VERSION' => '11'}) }

    it { is_expected.to eq 11 }
  end

  context "a request without an HTTP_X_API_VERSION returns nil" do
    let(:request) { instance_double('Request', \
      env: {'HTTP_ACCEPT' => 'text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c'}) }

    it { is_expected.to be_nil }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
versioncake-4.1.1 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-4.1.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-4.0.2 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-4.0.1 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-4.0.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-3.4.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-3.3.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-3.2.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-3.1.0 spec/unit/strategies/http_header_strategy_spec.rb
versioncake-3.0.0 spec/unit/strategies/http_header_strategy_spec.rb