Sha256: 236eec09287f8aa03e4dbfc5868cb0d000080811b9e1e206b5ca45a455e22788

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

@cli
Feature: Generate Content Blocks
  Developers should be able to generate content blocks within projects to define new data structures.

  Background:
    Given I create a module named "bcms_widgets"
    When I cd into the project "bcms_widgets"

  Scenario: Generate content block in a module
    When I run `rails g cms:content_block product name:string price:string`
    And the file "app/models/bcms_widgets/product.rb" should contain:
    """
    module BcmsWidgets
      class Product < ActiveRecord::Base
        acts_as_content_block
      end
    end
    """
    And the file "app/controllers/bcms_widgets/products_controller.rb" should contain:
    """
    module BcmsWidgets
      class ProductsController < Cms::ContentBlockController
      end
    end
    """
    And the file "app/views/bcms_widgets/products/render.html.erb" should contain:
    """
    <p><b>Name:</b> <%= @content_block.name %></p>
    <p><b>Price:</b> <%= @content_block.price %></p>
    """
    And a migration named "create_bcms_widgets_products.rb" should contain:
        """
        class CreateBcmsWidgetsProducts < ActiveRecord::Migration
          def change
            Cms::ContentType.create!(:name => "BcmsWidgets::Product", :group_name => "BcmsWidgets")
            create_content_table :bcms_widgets_products, :prefix=>false do |t|
              t.string :name
              t.string :price

              t.timestamps
            end
          end
        end
        """
    And the file "config/routes.rb" should contain:
    """
    BcmsWidgets::Engine.routes.draw do
      content_blocks :products

    end
    """







Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browsercms-3.4.2 features/generators/content_blocks_for_modules.feature
browsercms-3.4.2.rc1 features/generators/content_blocks_for_modules.feature
browsercms-3.4.1 features/generators/content_blocks_for_modules.feature
browsercms-3.4.0 features/generators/content_blocks_for_modules.feature
browsercms-3.4.0.rc2 features/generators/content_blocks_for_modules.feature
browsercms-3.4.0.rc1 features/generators/content_blocks_for_modules.feature