Sha256: 1d7c953397e66b629e2c58e2d034035d63a677bd65caaee0549ce7611e57f9cd

Contents?: true

Size: 619 Bytes

Versions: 3

Compression:

Stored size: 619 Bytes

Contents

require_relative 'spec_helper'
require 'action_dispatch'

describe ActiveModel::Form do
  let(:params) do
    { "form"=>
      {"upload" => ActionDispatch::Http::UploadedFile.new(:tempfile => __FILE__, :filename => 'file_attribute_form_spec.rb'),
      "whatever" => "yeah" } }
  end

  it "parses the Rails form helper file params" do
    class FormWithDateTime < ActiveModel::Form
      attribute :upload, :file
      attribute :whatever, :string
    end

    form = FormWithDateTime.new(params['form'])
    form.upload.must_be_kind_of ActionDispatch::Http::UploadedFile
    form.whatever.must_equal "yeah"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activemodel-form-1.2.0 spec/file_attribute_form_spec.rb
activemodel-form-1.1.0 spec/file_attribute_form_spec.rb
activemodel-form-1.0.0 spec/file_attribute_form_spec.rb