Sha256: d2b41255ee3ec49fdedca6454ee651a183796607e4984b7b99e91dd0532d7699

Contents?: true

Size: 936 Bytes

Versions: 6

Compression:

Stored size: 936 Bytes

Contents

Feature: Defining custom fields
  In order to extend the gem with customised fields
  As a developer
  I wish to define and register custom fields

  @custom @fields
  Scenario: Defining and using a custom field
    Given I have a field defined as:
      """Ruby
      class MyCustomField

        def initialize value = nil, options = {}
          @value, @options = value, options
        end
        attr_reader :options

        def raw
          @value
        end

        def populate value
          @value = value
        end

        def convert
          @value
        end

      end
      """
    When I register the field:
      """Ruby
      PR::Fields[:custom] = MyCustomField
      """
    Then I should be able define a form as:
      """Ruby
        class MyCustomFieldForm
          include PR::Form
          field :example, :custom
        end
      """
    And my form should have a `MyCustomField` example field

Version data entries

6 entries across 6 versions & 1 rubygems

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