diff options
author | Yves Senn <yves.senn@gmail.com> | 2017-03-26 11:42:39 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2017-03-26 12:11:45 +0200 |
commit | 27f103fc7e3260efe0b8dde66bf5354f2202ee32 (patch) | |
tree | ef196c56123ccb0859830c39b74b6458250d0bcf /railties/test | |
parent | d96dde82b7ff3a216c16eb87e2d346341ad53c05 (diff) | |
download | rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.tar.gz rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.tar.bz2 rails-27f103fc7e3260efe0b8dde66bf5354f2202ee32.zip |
add field ids when generating a scaffold form.
This is a follow up to a6d065e. When using `form_with` you must supply
field ids manually. Since the scaffold generator is using labels we
need to make sure that they are linked up properly.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 0e0ef7d293..bc76cead18 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -437,8 +437,8 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end assert_file "app/views/accounts/_form.html.erb" do |content| - assert_match(/^\W{4}<%= form\.text_field :name %>/, content) - assert_match(/^\W{4}<%= form\.text_field :currency_id %>/, content) + assert_match(/^\W{4}<%= form\.text_field :name, id: :account_name %>/, content) + assert_match(/^\W{4}<%= form\.text_field :currency_id, id: :account_currency_id %>/, content) end end @@ -461,8 +461,8 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end assert_file "app/views/users/_form.html.erb" do |content| - assert_match(/<%= form\.password_field :password %>/, content) - assert_match(/<%= form\.password_field :password_confirmation %>/, content) + assert_match(/<%= form\.password_field :password, id: :user_password %>/, content) + assert_match(/<%= form\.password_field :password_confirmation, id: :user_password_confirmation %>/, content) end assert_file "app/views/users/index.html.erb" do |content| |