On Fri, Jun 3, 2016 at 8:21 AM, Michelle McManus
<
michelle...@gmail.com> wrote:
> have a reached a point where I cannot figure out what I'm doing wrong.
> 1) UsersController PUT #update with invalid params re-renders the 'edit'
> template
> Failure/Error: expect(response).to render_template("edit")
> expecting <"edit"> but rendering with <[]>
> # ./spec/controllers/users_controller_spec.rb:156:in `block (4 levels)
> in <top (required)>'
After a quick look, it appears that you're expecting a validation failure
on this test, but the "invalid attributes" you're counting on aren't --
e.g. instead of
let(:invalid_attributes) {
{
first_name: @user.first_name,
password: @user.password
}
}
(which won't empty the email that was already set) try
let(:invalid_attributes) {
{
first_name: @user.first_name,
password: @user.password,
email: nil
}
}
and your save will fail.
HTH!
--
Hassan Schroeder ------------------------
hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote