Sha256: a09c9be2189c120c755d4881848e75629b3ee033e3fd9c3dfded9a798b41ac76

Contents?: true

Size: 498 Bytes

Versions: 8

Compression:

Stored size: 498 Bytes

Contents

require "test_helper"

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

  class AlbumForm < Reform::Form
    property :name, deserializer: { parse_pipeline: ->(input, options) { Representable::Pipeline[->(input, options) { options[:represented].name = input.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

8 entries across 8 versions & 1 rubygems

Version Path
reform-2.2.4 test/parse_pipeline_test.rb
reform-2.2.3 test/parse_pipeline_test.rb
reform-2.2.2 test/parse_pipeline_test.rb
reform-2.2.1 test/parse_pipeline_test.rb
reform-2.2.0 test/parse_pipeline_test.rb
reform-2.2.0.rc1 test/parse_pipeline_test.rb
reform-2.1.0 test/parse_pipeline_test.rb
reform-2.1.0.rc1 test/parse_pipeline_test.rb