diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-08-29 09:58:21 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-08-29 09:58:21 +0900 |
commit | 28e5085070f95f32a6a909cce6d77fd460c73885 (patch) | |
tree | 28f7c371a119c03590402609819927176405f970 /railties/test | |
parent | a8fff608148ad48e333b1f63b1d33df211bc658a (diff) | |
download | rails-28e5085070f95f32a6a909cce6d77fd460c73885.tar.gz rails-28e5085070f95f32a6a909cce6d77fd460c73885.tar.bz2 rails-28e5085070f95f32a6a909cce6d77fd460c73885.zip |
Generate the same value as a label of view in system test template
In the system test template, enter a value based on label.
However, since `label` method does not use `titleize` by default.
If generate a value including underscore, cannot find a label and the test
will fail.
```
$ ./bin/rails g scaffold user name:string phone_number:string
$ ./bin/rails t test/system/users_test.rb
E
Error:
UsersTest#test_creating_a_User:
Capybara::ElementNotFound: Unable to find field "Phone Number"
test/system/users_test.rb:18:in `block in <class:UsersTest>'
```
This removes unnecessary `titleize` so that the generated file will pass
even if the attribute contains an underscore.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 3e631f6021..e90834bc2b 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -514,7 +514,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "test/system/users_test.rb" do |content| assert_match(/fill_in "Password", with: 'secret'/, content) - assert_match(/fill_in "Password Confirmation", with: 'secret'/, content) + assert_match(/fill_in "Password confirmation", with: 'secret'/, content) end assert_file "test/fixtures/users.yml" do |content| |