Sha256: 65af08a2df9a5f8910fa211a5624dcab5da633721d22bae859337f4742673f7d

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

Feature: mapping a node's children to to another object
  So that I don't have to spend all my time typing in repetitive XPaths
  As an API consumer
  I want to map a node to a series of other objects

  Scenario: I have a simple mapping
    Given I have car with brand and colours
    And I have a colour class with description and hex and a from_node method
    And I have the XML:
      """
      <car>
        <brand>Fawd</brand>
        <colour>
          <description>Red</description>
          <hex>#FF0000</hex>
        </colour>
        <colour>
          <description>Blue</description>
          <hex>#0000FF</hex>
        </colour>
      </car>
      """
    When I map the car node to a car object with:
      """
        map.string :brand
        map.each :colour, :as => Colour, :to => :colours
      """
    Then the car should have a brand of "Fawd"
    And the car should have a colour with a description of "Red" and a hex of "#FF0000"
    And the car should have a colour with a description of "Blue" and a hex of "#0000FF"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dozuki-mapper-0.1.2 features/each_mapping.feature
dozuki-mapper-0.1.1 features/each_mapping.feature
dozuki-mapper-0.1.0 features/each_mapping.feature
dozuki-mapper-0.0.2 features/each_mapping.feature
dozuki-mapper-0.0.1 features/each_mapping.feature