diff --git a/spec/dummy_app/db/migrate/20151027181550_change_field_test_id_to_nested_field_tests.rb b/spec/dummy_app/db/migrate/20151027181550_change_field_test_id_to_nested_field_tests.rb new file mode 100644 index 0000000000..e93665b2f6 --- /dev/null +++ b/spec/dummy_app/db/migrate/20151027181550_change_field_test_id_to_nested_field_tests.rb @@ -0,0 +1,5 @@ +class ChangeFieldTestIdToNestedFieldTests < ActiveRecord::Migration + def change + change_column :nested_field_tests, :field_test_id, :integer, null: false + end +end diff --git a/spec/integration/config/edit/rails_admin_config_edit_spec.rb b/spec/integration/config/edit/rails_admin_config_edit_spec.rb index 275c05c868..dcf3716676 100644 --- a/spec/integration/config/edit/rails_admin_config_edit_spec.rb +++ b/spec/integration/config/edit/rails_admin_config_edit_spec.rb @@ -706,7 +706,8 @@ class HelpTest < Tableless describe 'nested form' do it 'works', js: true do @record = FactoryGirl.create :field_test - @record.nested_field_tests = [NestedFieldTest.create!(title: 'title 1'), NestedFieldTest.create!(title: 'title 2')] + NestedFieldTest.create! title: 'title 1', field_test: @record + NestedFieldTest.create! title: 'title 2', field_test: @record visit edit_path(model_name: 'field_test', id: @record.id) find('#field_test_comment_attributes_field .add_nested_fields').click @@ -743,7 +744,7 @@ class HelpTest < Tableless end end @record = FieldTest.create - @record.nested_field_tests << NestedFieldTest.create!(title: 'title 1') + NestedFieldTest.create! title: 'title 1', field_test: @record visit edit_path(model_name: 'field_test', id: @record.id) expect(find('#field_test_nested_field_tests_attributes_0_title_field')).to have_content('NestedFieldTest') end @@ -776,7 +777,7 @@ class HelpTest < Tableless it 'does not show destroy button except for newly created when :allow_destroy is false' do @record = FieldTest.create - @record.nested_field_tests << NestedFieldTest.create!(title: 'nested title 1') + NestedFieldTest.create! title: 'nested title 1', field_test: @record allow(FieldTest.nested_attributes_options).to receive(:[]).with(:nested_field_tests). and_return(allow_destroy: false, update_only: false) visit edit_path(model_name: 'field_test', id: @record.id)