Sha256: 55c5d9ff43b54c4bb4690bf83f79a8a815d8e44ccf71728015ce8e09d7e2d5bd

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

require './test/test_helper'

class ViewAdditionsTest < ActiveSupport::TestCase
  setup do
    @resolver = ActionView::PathResolver.new
  end

  test "it retrieves the correct handler and format when only handler and format are present" do
    handler, format = @resolver.extract_handler_and_format('application.html.erb', nil)
    assert_equal 'text/html', format.to_s
  end

  test "it retrieves the correct handler and format when only handler, format and version are present" do
    handler, format = @resolver.extract_handler_and_format('application.json.v1.jbuilder', nil)
    assert_equal 'application/json', format.to_s
  end

  test "it retrieves the correct handler and format when only handler, format and locale are present" do
    handler, format = @resolver.extract_handler_and_format('application.en.json.jbuilder', nil)
    assert_equal 'application/json', format.to_s
  end

  test "it retrieves the correct handler and format when only handler, format, locale and version are present" do
    handler, format = @resolver.extract_handler_and_format('application.en.json.v1.jbuilder', nil)
    assert_equal 'application/json', format.to_s
  end

  if ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1
    test "it retrieves the correct handler and format when only handler, format, variant and version are present" do
      handler, format = @resolver.extract_handler_and_format('application.json+tablet.v1.jbuilder', nil)
      assert_equal 'application/json', format.to_s
    end
  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/view_additions_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/versioncake-2.3.1/test/unit/view_additions_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/versioncake-2.3.1/test/unit/view_additions_test.rb
versioncake-2.5.0 test/unit/view_additions_test.rb
versioncake-2.4.0 test/unit/view_additions_test.rb
versioncake-2.3.1 test/unit/view_additions_test.rb
versioncake-2.3.0 test/unit/view_additions_test.rb
versioncake-2.2.0 test/unit/view_additions_test.rb
versioncake-2.1.0 test/unit/view_additions_test.rb
versioncake-2.0.0 test/unit/view_additions_test.rb