Sha256: 876cd2a707b2a89dcbd39a8bcb0ba016ff8c9d85298b077ad9a890850837e3a5

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'
require_relative 'fixtures/components/test-renderer/models/legacy_module'
require_relative 'fixtures/components/test-renderer/models/legacy_shared_module'
require_relative 'fixtures/components/test-renderer/models/translating_module'

describe Alephant::Renderer::Views::Html do
  let(:data) { nil }
  let(:test_renderer) { MyApp::LegacyModule }

  subject { test_renderer.new(data) }

  describe 'Interface tests (backwards compatibility)' do
    it 'should accept self.template_path calls' do
      expect(subject.class.template_path).to eq('/ignored/path/to/templates')
    end

    it 'should render from a local template (with template_path set)' do
      expect(subject.render).to eq('legacy module template')
    end

    describe 'Shared template test' do
      let(:test_renderer) { MyApp::LegacySharedModule }

      it 'should render a local template that points to a shared template (with template_path set)' do
        expect(subject.render).to eq('legacy shared module template')
      end
    end
  end

  describe 'Interface tests' do
    describe 'Translation test' do
      before(:all) do
        ::I18n.backend = I18n::Backend::Simple.new
      end

      let(:test_renderer) { MyApp::TranslatingModule }

      it 'should render a template with a translated string' do
        expect(subject.render).to eq('modern shared module template')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-renderer-3.2.0 spec/integration/views_html_spec.rb
alephant-renderer-3.1.0 spec/integration/views_html_spec.rb
alephant-renderer-3.0.0 spec/integration/views_html_spec.rb