Sha256: 36a287f3ad900a29800adfef0168feee2aec26acc021963c5d0bbfe305430ac1

Contents?: true

Size: 996 Bytes

Versions: 35

Compression:

Stored size: 996 Bytes

Contents

require 'test_helper'

module PushType
  class TemplatableTest < ActiveSupport::TestCase

    class TestPage < PushType::Node
    end

    class TestPageTemplate < PushType::Node
      template :foo
    end

    class TestPageTemplateArgs < PushType::Node
      template :foo, path: 'bar', layout: 'my_layout'
    end

    describe '.template' do
      describe 'defaults' do
        let(:page) { TestPage.new }
        it { page.template.must_equal 'nodes/push_type/templatable_test/test_page' }
        it { page.template_args.must_equal ['nodes/push_type/templatable_test/test_page', {}] }
      end

      describe 'set template' do
        let(:page) { TestPageTemplate.new }
        it { page.template.must_equal 'nodes/foo' }
      end

      describe 'set template with args' do
        let(:page) { TestPageTemplateArgs.new }
        it { page.template.must_equal 'bar/foo' }
        it { page.template_args.must_equal ['bar/foo', { layout: 'my_layout' }] }
      end

    end

  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
push_type_core-0.12.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.12.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.12.0.beta.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.11.2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.11.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.11.0.beta.2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.11.0.beta.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.4 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.3 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.0.beta.5 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.10.0.beta.3 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.5 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.3 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.9.0.beta.4 test/models/concerns/push_type/templatable_test.rb