On Fri, Jun 3, 2016 at 8:21 AM, Michelle McManus 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.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yBxJchHTJGH-qor9wgkOaTpPgBR7T%3DrL3FRUAaYkSKhJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJun 3, '16 at 4:04p
activeJun 3, '16 at 11:55p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase