Sha256: 78a914c58960233b72453fcd2200f58983d9a86fed6a2fa399ae04d16d38544e

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

Feature: Building a form from an existing models
  In order to apply user input to an existing model
  As a developer
  I wish to use a defined form to display existing data

  @form @basic @model
  Scenario: Basic Form
    Given I have a form defined as:
      """Ruby
        class MyForm
          include PR::Form

          field :event_name, :string
          field :start_date, :date

        end
      """
    And I have a model defined as:
      """Ruby
        @model = Struct.new(:event_name,:start_date).new 'An Event', Date.civil(2013,2,28)
      """
    When I build my form from a model:
      """Ruby
        @form = PR::BuildFromModel[ MyForm, @model ]
      """
    Then my form should have a event_name of "An Event"
    Then my form should have a start_date of "28/02/2013"

  @form @macro @model
  Scenario: Basic Form built using macro
    Given I have a form defined as:
      """Ruby
        class MyForm
          include PR::Form

          field :event_name, :string
          field :start_date, :date

        end
      """
    And I have a model defined as:
      """Ruby
        @model = Struct.new(:event_name,:start_date).new 'An Event', Date.civil(2013,2,28)
      """
    When I build my form using the macro:
      """Ruby
        @form = MyForm.from_model @model
      """
    Then my form should have a event_name of "An Event"
    Then my form should have a start_date of "28/02/2013"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pr-1.0.0 features/building_forms_from_models.feature
pr-0.0.7 features/building_forms_from_models.feature
pr-0.0.6 features/building_forms_from_models.feature
pr-0.0.5 features/building_forms_from_models.feature
pr-0.0.4 features/building_forms_from_models.feature
pr-0.0.3 features/building_forms_from_models.feature
pr-0.0.2 features/building_forms_from_models.feature