Sha256: 631edb47b062add1bc495d5d22a4a6173404f457aa4838880e62459911b527f9
Contents?: true
Size: 795 Bytes
Versions: 6
Compression:
Stored size: 795 Bytes
Contents
require 'test_helper' class HelperTest < ActionView::TestCase include StorageHelper test 'fields for' do product = Product.create(pictures: [image]) product.run_callbacks :commit product.pictures.build html = form_for(product, url: 'test') do |f| f.fields_for(:pictures) do |ff| ff.file_field(:value) + ff.number_field(:position) end end assert html.include?('[pictures_attributes][0][id]') assert html.include?('[pictures_attributes][0][value]') assert html.include?('[pictures_attributes][0][position]') assert html.exclude?('[pictures_attributes][1][id]') assert html.include?('[pictures_attributes][1][value]') assert html.include?('[pictures_attributes][1][position]') product.pictures.destroy end end
Version data entries
6 entries across 6 versions & 1 rubygems