Skip to content

Submit stub swallows arguments without raising an error #16

@jackjennings

Description

@jackjennings

Writing a test with the test helper for the following test will pass, while executing the code in the controller will actually raise an exception:

class FooController
  def create
    submit FooForm, Foo.new, params, extra_argument
  end
end

class FooControllerTest
  def test_should_create
    assert_submits OrderForm, stub: order_double do
      post foos_url
    end
  end
end

The stub that replaces the submit method verifies that the first argument is the correct form, but not that the second and third arguments are present (and no more than that).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions