Sha256: 15a11b466f4bf0ed3de83ea55a7ff2aac15ff69fef330634589c128171961dda

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

require "test_helper"

class VersionRenderTest < ActiveSupport::TestCase

  def setup
    path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)
    view_paths = ActionView::PathSet.new([path])
    @view = ActionView::Base.new(view_paths)
  end

  def test_regression_renders_unversioned_template
    @view.lookup_context.versions = [:v0]
    assert_equal "template", @view.render(:template => "templates/versioned")
  end

  def test_render_template_defaults_to_latest_template_version
    assert_equal "template v3", @view.render(:template => "templates/versioned")
  end

  def test_render_template_with_parameter_version_override
    assert_equal "template v1", @view.render(:template => "templates/versioned", :versions => :v1)
  end

  def test_render_template_with_legacy_version
    @view.lookup_context.versions = [:v2]
    assert_equal "template v2", @view.render(:template => "templates/versioned")
  end

  def test_render_template_gracefully_degrades
    @view.lookup_context.versions = [:v4,:v3,:v2,:v1]
    assert_equal "template v3", @view.render(:template => "templates/versioned")
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
versioncake-0.5.0 test/template/render_test.rb
versioncake-0.4.0 test/template/render_test.rb
versioncake-0.3.2 test/template/render_test.rb
versioncake-0.3.1 test/template/render_test.rb
versioncake-0.3.0 test/template/render_test.rb
versioncake-0.2.0 test/template/render_test.rb