Sha256: c79f0303b76a041e73635052d2e56a49226dbf48f743f0fdf0fae60ab1453b43

Contents?: true

Size: 937 Bytes

Versions: 5

Compression:

Stored size: 937 Bytes

Contents

require "test_helper"

module PushType
  describe Templatable do

    let(:page) { TestPage.new }
    
    describe '.template' do
      describe 'defaults' do
        before do
          # Set class instance variables to nil
          TestPage.instance_variable_set '@template_name', nil
          TestPage.instance_variable_set '@template_opts', nil
        end
        before { page.template.must_equal 'nodes/test_page' }
        before { page.template_args.must_equal ['nodes/test_page', {}] }
      end

      describe 'set template' do
        before { TestPage.template :foo }
        before { page.template.must_equal 'nodes/foo' }
      end

      describe 'set template with args' do
        before { TestPage.template :foo, layout: 'my_layout' }
        before { page.template.must_equal 'nodes/foo' }
        before { page.template_args.must_equal ['nodes/foo', { layout: 'my_layout' }] }
      end
      
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
push_type_core-0.2.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.2.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.2.0.beta2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.1.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.1.0 test/models/concerns/push_type/templatable_test.rb