Sha256: 31e8649b4cac2096ee9219cb127ff2784ef99723f79148955ab0c4731a355ca7

Contents?: true

Size: 810 Bytes

Versions: 10

Compression:

Stored size: 810 Bytes

Contents

require './test/test_helper'

class QueryParameterStrategyTest < ActiveSupport::TestCase
  setup do
    @strategy = VersionCake::QueryParameterStrategy.new
  end

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

  test "a request with an Integer api_version parameter retrieves the version" do
    request = stub(:query_parameters => {:api_version => 11, :other => 'parameter'})
    assert_equal 11, @strategy.extract(request)
  end

  test "a request without an api_version parameter returns nil" do
    request = stub(:query_parameters => {:other => 'parameter', :another => 'parameter'})
    assert_nil @strategy.extract(request)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

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