Sha256: 0503f21cc0dd78efde93ad931eedca3010f92e794a68788436d0794bf6f11ef2

Contents?: true

Size: 969 Bytes

Versions: 8

Compression:

Stored size: 969 Bytes

Contents

require './spec/rails_helper'

describe ActionView::Base do
  let(:path) { ActionView::FileSystemResolver.new('./spec/fixtures') }
  let(:view_paths) { ActionView::PathSet.new([path]) }
  let(:view) { ActionView::Base.new(view_paths) }
  let(:version_override) { nil }
  subject { view.render(template: 'templates/versioned', versions: version_override) }

  context 'with a 0 version' do
    before { view.lookup_context.versions = [:v0] }

    it { is_expected.to eq 'template' }
  end

  context 'with the version override set' do
    let(:version_override) { :v1 }

    it { is_expected.to eq 'template v1' }
  end

  context 'with an older version in the lookup context' do
    before { view.lookup_context.versions = [:v2] }

    it { is_expected.to eq 'template v2' }
  end

  context 'with a v4 requested, but only highest templates is v3' do
    before { view.lookup_context.versions = [:v4,:v3,:v2,:v1] }

    it { is_expected.to eq 'template v3' }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
versioncake-4.0.2 spec/integration/view/render_spec.rb
versioncake-4.0.1 spec/integration/view/render_spec.rb
versioncake-4.0.0 spec/integration/view/render_spec.rb
versioncake-3.4.0 spec/integration/view/render_spec.rb
versioncake-3.3.0 spec/integration/view/render_spec.rb
versioncake-3.2.0 spec/integration/view/render_spec.rb
versioncake-3.1.0 spec/integration/view/render_spec.rb
versioncake-3.0.0 spec/integration/view/render_spec.rb