Sha256: 3f663e4a9b28b95482cb4c842290c5b48fe795b61d864e3cc7eaa49529c2a3e1

Contents?: true

Size: 944 Bytes

Versions: 10

Compression:

Stored size: 944 Bytes

Contents

require './test/test_helper'
require 'action_controller'
require 'action_controller/test_case'

class MultipleStrategyTest < ActionController::TestCase
  tests RendersController

  test "renders version 1 of the partial based on the header Accept" do
    @controller.request.stubs(:headers).returns({"HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8;api_version=1"})
    get :index
    assert_equal "template v1", @response.body
  end

  test "renders the query parameter when accept parameter isn't available" do
    get :index, "api_version" => "1"
    assert_equal "template v1", @response.body
  end

  test "renders the higher priority accept parameter version" do
    @controller.request.stubs(:headers).returns({"HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8;api_version=2"})
    get :index, "api_version" => "1"
    assert_equal "template v2", @response.body
  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/functional/multiple_strategy_controller_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/versioncake-2.3.1/test/functional/multiple_strategy_controller_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/versioncake-2.3.1/test/functional/multiple_strategy_controller_test.rb
versioncake-2.5.0 test/functional/multiple_strategy_controller_test.rb
versioncake-2.4.0 test/functional/multiple_strategy_controller_test.rb
versioncake-2.3.1 test/functional/multiple_strategy_controller_test.rb
versioncake-2.3.0 test/functional/multiple_strategy_controller_test.rb
versioncake-2.2.0 test/functional/multiple_strategy_controller_test.rb
versioncake-2.1.0 test/functional/multiple_strategy_controller_test.rb
versioncake-2.0.0 test/functional/multiple_strategy_controller_test.rb