Sha256: ca0de90905ce1f0a9502f5518e337bfe1e463e81b7cff802c8ef08c6d354c8b7
Contents?: true
Size: 782 Bytes
Versions: 6
Compression:
Stored size: 782 Bytes
Contents
require_relative 'spec_helper' describe ActiveModel::Form do # DateTime params generated by the Rails form helpers look like this let(:params) do { "form"=> {"created_at(1i)"=>"2012", "created_at(2i)"=>"8", "created_at(3i)"=>"2", "created_at(4i)"=>"17", "created_at(5i)"=>"21", "whatever"=>"yeah"} } end it "parses the Rails form helper datetime params" do class FormWithDateTime < ActiveModel::Form attribute :created_at, :date_time attribute :something_else, :string attribute :whatever, :string end form = FormWithDateTime.new(params['form']) form.created_at.must_equal(DateTime.new(2012, 8, 2, 17, 21)) form.something_else.must_equal nil form.whatever.must_equal "yeah" end end
Version data entries
6 entries across 6 versions & 1 rubygems