Sha256: 5fb46d3be3a0d4c4e1f53719502d574f151a326052242231aa8de84b52e02cb1

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

require "test_helper"

class ParsePipelineTest < MiniTest::Spec
  Album = Struct.new(:name)

  class AlbumForm < TestForm
    property :name, deserializer: {parse_pipeline: ->(input, options) { Representable::Pipeline[->(ipt, opts) { opts[:represented].name = ipt.inspect }] }}
  end

  it "allows passing :parse_pipeline directly" do
    form = AlbumForm.new(Album.new)
    form.validate("name" => "Greatest Hits")
    _(form.name).must_equal "{\"name\"=>\"Greatest Hits\"}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.3 test/parse_pipeline_test.rb