Skip to content

Commit

Permalink
Fix a faulty form_for test
Browse files Browse the repository at this point in the history
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`. :-)
  • Loading branch information
gsamokovarov committed Oct 29, 2015
1 parent c2c7cea commit 252660b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions actionview/test/template/form_helper_test.rb
Expand Up @@ -1539,9 +1539,10 @@ def test_auto_index_with_nil_id
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
Expand Down

0 comments on commit 252660b

Please sign in to comment.