Sha256: a870ab04793c5ef072706e721837e6a543fd9aca170434ee7648c888387a13c6

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 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

3 entries across 3 versions & 1 rubygems

Version Path
reform-2.3.2 test/parse_pipeline_test.rb
reform-2.3.1 test/parse_pipeline_test.rb
reform-2.3.0.rc2 test/parse_pipeline_test.rb