Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Testing strong params

testing

  • Please log in to reply
1 reply to this topic

#1 johns276

johns276

    Passenger

  • Members
  • 8 posts
  • LocationNashville, TN

Posted 15 August 2013 - 08:32 PM

I am migrating a 3.2.x application to 4. With the move to raise a ForbiddenAtributesError when mass assignment is done, what is a good  way, maybe a best practices way, for testing which attributes have been permitted and which have not. Littering controller code with params.permit! doesn't seem like a great idea. :)

 

Pointers would be appreciated. BTW, I use shoulda.

 

Charles



#2 Jemagee

Jemagee

    Inspector

  • Members
  • 62 posts

Posted 15 August 2013 - 08:36 PM

Is this rspec test what you're looking for?

 

I prefer the .should raise_error test







Also tagged with one or more of these keywords: testing

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users