Rails controller testing - Validation errors do not raise a HTTP error response -


i have actioncontroller derived test sends 'post' request controller under test incorrect data. controller tries create new object , save it. model has validation methods triggered on save , generate validation error detecting incorrect data sent test.

so far good. now, controller verifies http response status failure using assert_response :failure. however, test fails @ step saying:

expected response <:failure>, <200>

the @obj.errors correctly populated validation error somehow http response 200.

any clues?

what controller code do? usual way handle validation errors in rails send 200 ok response (e.g. render :action => 'new'). response contains form (populated submitted parameters) along validation error messages.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -