Sha256: 3cec550be02bd54f7880ea14827d09875fe8c755acedc9192c471b7171673069

Contents?: true

Size: 1.31 KB

Versions: 21

Compression:

Stored size: 1.31 KB

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class CmsBlockTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    CmsBlock.all.each do |block|
      assert block.valid?, block.errors.full_messages.to_s
    end
  end
  
  def test_new_via_page_nested_attributes
    assert_difference ['CmsPage.count', 'CmsBlock.count'] do
      page = CmsPage.create!(
        :cms_site   => cms_sites(:default),
        :cms_layout => cms_layouts(:default),
        :label      => 'test page',
        :slug       => 'test_page',
        :parent_id  => cms_pages(:default).id,
        :cms_blocks_attributes => [
          {
            :label    => 'test_block',
            :content  => 'test_content'
          }
        ]
      )
      assert_equal 1, page.cms_blocks.count
      block = page.cms_blocks.first
      assert_equal 'test_block', block.label
      assert_equal 'test_content', block.content
    end
  end
  
  def test_initialize_or_find
    tag = CmsTag::PageText.initialize_or_find(cms_pages(:default), :default_field_text)
    assert_equal 'default_field_text', tag.label
    assert_equal 'default_field_text_content', tag.content
    
    tag = CmsTag::PageText.initialize_or_find(cms_pages(:default), :new_block)
    assert_equal 'new_block', tag.label
    assert tag.content.blank?
  end
  
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
comfortable_mexican_sofa-1.0.51 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.50 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.49 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.48 test/unit/cms_block_test.rb
lucy_cms-0.0.6 test/unit/cms_block_test.rb
lucy_cms-0.0.5 test/unit/cms_block_test.rb
lucy_cms-0.0.4 test/unit/cms_block_test.rb
lucy_cms-0.0.3 test/unit/cms_block_test.rb
lucy_cms-0.0.2 test/unit/cms_block_test.rb
lucy_cms-0.0.1 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.47 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.46 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.45 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.44 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.43 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.42 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.41 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.40 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.39 test/unit/cms_block_test.rb
comfortable_mexican_sofa-1.0.38 test/unit/cms_block_test.rb