Sha256: e1a2d3af20084158bb5ecf05a6ccd2bc4d417e78ab3445e372e5a112e4c2f12b

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require 'action_tree'
require 'haml'

module Templated
  extend ActionTree::Dialect
  class Node < ActionTree::Basic::Node; end
  class Match < ActionTree::Basic::Match; end
  apply(ActionTree::Plugins::Tilt)
end


describe Templated::Node do

  pending 'still passes normal specs'

  it 'allows setting view path' do
    subject.view_path('Bahamas')
    subject.view_path.should == 'Bahamas'
  end

  it 'inherits view path' do
    subject.view_path('Brazil')
    subject.action('/mediocrity') { 'hmm..' }
    subject.match('/mediocrity').view_path.should == 'Brazil'
  end

  it 'inherits layout path' do
    subject.layout('Congo')
    subject.action('Uzbekistan') { }
    subject.match('Uzbekistan').layout.should == 'Congo'
  end

  # inherits layouts, independent by namespace

  describe 'renders' do

    it 'haml' do
      subject.view_path('.')
      subject.action { render 'spec/fixtures/test.haml' }
      subject.match.run.should == "<p>Yippee</p>\n"
    end

    it 'haml within a layout defined by an ancestor' do
      subject.layout('/spec/fixtures/test_layout.haml')
      subject.action('hi') { render 'spec/fixtures/test.haml' }
      subject.match('hi').run.should == "<body><p>Yippee</p></body>\n"
    end

  end

end








Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
action_tree-0.1.1 spec/p01_tilt_spec.rb
action_tree-0.1.0 spec/p01_tilt_spec.rb