diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-10-29 16:31:41 +0200 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-10-29 16:38:25 +0200 |
commit | 252660b886c8880fc8c43a1c4bc84f07c9a9aab7 (patch) | |
tree | 49973b1c4e42ddd7003f617e9f9d687cc477eebe /actionview/test/template | |
parent | c2c7cea13ae8b5eb2e96b194cc9c141784ea1f36 (diff) | |
download | rails-252660b886c8880fc8c43a1c4bc84f07c9a9aab7.tar.gz rails-252660b886c8880fc8c43a1c4bc84f07c9a9aab7.tar.bz2 rails-252660b886c8880fc8c43a1c4bc84f07c9a9aab7.zip |
Fix a faulty form_for test
Stumbled upon this one while trying to deprecate the String/Symbol
passing to `form_for`.
This test passed on an accident, because the signature of `form_for`
currently accepts 2 positional arguments and a block. Calling it with
the wrong number of arguments caused:
```ruby
(byebug) form_for(:post, @post, html: { id: 'create-post' })
*** ArgumentError Exception: wrong number of arguments (3 for 1..2)
```
This made the test pass, because it was still an `ArgumentError`. :-)
Diffstat (limited to 'actionview/test/template')
-rw-r--r-- | actionview/test/template/form_helper_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 77c660d450..f6181c28fd 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -1539,9 +1539,10 @@ class FormHelperTest < ActionView::TestCase end def test_form_for_requires_block - assert_raises(ArgumentError) do - form_for(:post, @post, html: { id: 'create-post' }) + error = assert_raises(ArgumentError) do + form_for(@post, html: { id: 'create-post' }) end + assert_equal "Missing block", error.message end def test_form_for_requires_arguments |