Sha256: 28a7f5c17241556b3afa18ed2ee9dcd6163df92e00619367c4415c3e5d229c8b

Contents?: true

Size: 561 Bytes

Versions: 13

Compression:

Stored size: 561 Bytes

Contents

require './test/test_helper'

class HttpHeaderStrategyTest < ActiveSupport::TestCase
  setup do
    @strategy = VersionCake::HttpHeaderStrategy.new
  end

  test "a request with an HTTP_X_API_VERSION retrieves the version" do
    request = stub(:headers => {'HTTP_X_API_VERSION' => '11'})
    assert_equal 11, @strategy.extract(request)
  end

  test "a request without an HTTP_X_API_VERSION returns nil" do
    request = stub(:headers => {'HTTP_ACCEPT' => 'text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c'})
    assert_nil @strategy.extract(request)
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/versioncake-2.3.1/test/unit/strategies/http_header_strategy_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/versioncake-2.3.1/test/unit/strategies/http_header_strategy_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/versioncake-2.3.1/test/unit/strategies/http_header_strategy_test.rb
versioncake-2.5.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.4.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.3.1 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.3.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.2.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.1.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-2.0.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-1.3.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-1.2.0 test/unit/strategies/http_header_strategy_test.rb
versioncake-1.1.0 test/unit/strategies/http_header_strategy_test.rb