Sha256: 3345d1bc7f8b794cd52ac7f5285a8caa4b21ee3d7b4ec96891cca8d111d9b131

Contents?: true

Size: 958 Bytes

Versions: 20

Compression:

Stored size: 958 Bytes

Contents

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

class BlockTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    Cms::Block.all.each do |block|
      assert block.valid?, block.errors.full_messages.to_s
    end
  end
  
  def test_new_via_page_nested_attributes
    assert_difference ['Cms::Page.count', 'Cms::Block.count'] do
      page = Cms::Page.create!(
        :site       => cms_sites(:default),
        :layout     => cms_layouts(:default),
        :label      => 'test page',
        :slug       => 'test_page',
        :parent_id  => cms_pages(:default).id,
        :blocks_attributes => [
          {
            :label    => 'default_page_text',
            :content  => 'test_content'
          }
        ]
      )
      assert_equal 1, page.blocks.count
      block = page.blocks.first
      assert_equal 'default_page_text', block.label
      assert_equal 'test_content', block.content
    end
  end
  
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.3.8 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.7 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.6 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.5 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.4 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.3 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.2 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.1 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.3.0 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.8 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.7 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.6 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.5 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.4 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.3 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.2 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.1 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.2.0 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.1.2 test/unit/models/block_test.rb
comfortable_mexican_sofa-1.1.1 test/unit/models/block_test.rb