Sha256: 3353c9e6374f44cb0aadeef3b2d5dcbc82db2c4a853540473ab7f01c856b58e5
Contents?: true
Size: 921 Bytes
Versions: 13
Compression:
Stored size: 921 Bytes
Contents
require 'spec_helper' RSpec.describe ActionView::Helpers::FormBuilder do let(:employee){ Employee.create section: 'SE1' } subject{ described_class.new :collection, Employee::Collection.new([employee]), @template, {}} before do # http://pivotallabs.com/testing-custom-form-builder/ @template = Object.new @template.extend ActionView::Helpers::FormTagHelper @template.extend ActionView::Helpers::FormOptionsHelper @template.extend ActionView::Helpers::FormHelper end describe '.collection_ids' do it 'returns the collection ids as hidden fields' do subject.collection_ids.should eq %{<input type="hidden" name="ids[]" value="#{employee.id}" />} end it "does not raise when the object is not a collection object" do form_builder = described_class.new :employee, employee, @template, {} expect{ form_builder.collection_ids }.not_to raise_error end end end
Version data entries
13 entries across 13 versions & 1 rubygems