Sha256: f5fa605edb431ad7d4e7479c4163d0d40d315cffd6ab5755b9ecba09499a7418

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class LayoutTest < ActiveSupport::TestCase
  
  context "Layout" do
    
    setup do
      detonate
      load_layouts
    end
    
    should "load the layouts" do
      assert_equal 10, ActsAsLayoutable::Layout.count
      assert_equal 7, ActsAsLayoutable::Area.count(:select => "DISTINCT name")
      assert_equal 9, ActsAsLayoutable::Widget.count(:select => "DISTINCT name")
    end
    
    should "associate the correct areas to the layouts" do
      blog = ActsAsLayoutable::Layout.find_by_name("blog")
      assert_equal 6, blog.areas.length
    end
    
    context "create layouts for model" do
      setup do
        @page = Page.create!(:title => "Page title!")
        @page.layouts << ActsAsLayoutable::Layout.first
      end
      
      should "have one layout" do
        assert_equal 1, @page.layouts.length
      end
    end
    
    teardown do
      detonate
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts-as-layoutable-0.0.1.7 test/test_layout.rb