Sha256: b29c2d3619ea42d5b2c6a2a182e492c507a660f6171f1248477cc45bbdc2f834

Contents?: true

Size: 880 Bytes

Versions: 2

Compression:

Stored size: 880 Bytes

Contents

Feature: Overwriting the original file with a transformation

  If the argument to a `transform` block is a single file (or rather, its name as a symbol) then both the source
  and the target of that transformation will be the specified file. In this case the data in the file will be
  processed and the file overwritten with the transformed data.


  Scenario:
    Given a file named "command_script.rb" with:
    """
    file :items do
      field :name
    end

    transform :items do |record|
      record[:name] = record[:name][0]
      output record
    end
    """
    And a file named "items.csv" with:
    """
    name
    ab
    cd
    ef
    """
    When I run `forge command_script.rb`
    Then the exit status should be 0
    And a file named "items.csv" should exist
    And the file "items.csv" should contain exactly:
    """
    name
    a
    c
    e

    """

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
data_forge-0.1.1 features/transform/overwrite_original_file.feature
data_forge-0.1 features/transform/overwrite_original_file.feature