Sha256: 1727259c9e0a09b7f6a96c00e96c5640d07354b5f8e7695fac24a308b8c05789

Contents?: true

Size: 1022 Bytes

Versions: 9

Compression:

Stored size: 1022 Bytes

Contents

require "test_helper"

module PushType
  describe Templatable do

    let(:page) { TestPage.new }

    before do
      TestPage.instance_variable_set '@template_name', nil
      TestPage.instance_variable_set '@template_opts', nil
    end
    after do
      TestPage.instance_variable_set '@template_name', nil
      TestPage.instance_variable_set '@template_opts', nil
    end
    
    describe '.template' do
      describe 'defaults' do
        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, path: 'bar', layout: 'my_layout' }
        before { page.template.must_equal 'bar/foo' }
        before { page.template_args.must_equal ['bar/foo', { layout: 'my_layout' }] }
      end
      
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
push_type_core-0.5.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0.alpha.5 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0.alpha.4 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0.alpha.3 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0.alpha.2 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.5.0.alpha.1 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.4.0 test/models/concerns/push_type/templatable_test.rb
push_type_core-0.4.0.beta.3 test/models/concerns/push_type/templatable_test.rb