Sha256: fee83dd6783717c05e4405b42201c551259b1af3f0aca1169755325abeab11fc

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

require "./test/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

14 entries across 14 versions & 2 rubygems

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