Testing strong parameters

Hi guys,

Has anyone figured out how to test strong parameters?

They all pass. That’s the problem. Mass-assignment doesn’t seem to get
caught by the testing environment.

On Tue, Mar 4, 2014 at 1:13 PM, bertly_the_coder [email protected]
wrote:

They all pass. That’s the problem. Mass-assignment
doesn’t seem to get caught by the testing environment.

Ah, yes, that is odd. Maybe you could check out the tests from that
part of Rails, or of the strong_parameters gem, and see how they do
it.

-Dave


Dave A., the T. Rex of Codosaurus LLC (www.codosaur.us);
FREELANCE SOFTWARE DEVELOPER, AVAILABLE AS OF MARCH 1st 2014;
creator of Pull Request Roulette, at PullRequestRoulette.com.

On Tue, Mar 4, 2014 at 8:49 AM, bertly_the_coder [email protected]
wrote:

Has anyone figured out how to test strong parameters?

You mean test the concept itself, or test that your usage of it does
what you intend? I haven’t done so, but offhand, I would guess you
could do that by testing a few requests with good or bad parameter
sets, and seeing whether Rails gritches about them or not.

-Dave


Dave A., the T. Rex of Codosaurus LLC (www.codosaur.us);
FREELANCE SOFTWARE DEVELOPER, AVAILABLE AS OF MARCH 1st 2014;
creator of Pull Request Roulette, at PullRequestRoulette.com.

LOL! Thx Dave.

Anyone else figured/figuring this out or found some documentation about
it?

Use permitters instead. Easily testable.

Thx Fredrick! You’re a STAR!

On Wed, Mar 5, 2014 at 2:34 PM, Frederick C.
<[email protected]

wrote:


.

For more options, visit https://groups.google.com/groups/opt_out.


Clarity is self-created. The universe is waiting on you, not the other
way
around - Me.

“Life isn’t about finding yourself. Life is about creating yourself.” -
G.
Bernard Shaw

“Life is what happens while you are busy making plans” - John Lennon

NAMASTE!!! Yeah I said it!!

On Tuesday, March 4, 2014 1:49:34 PM UTC, bertly_the_coder wrote:

Hi guys,

Has anyone figured out how to test strong parameters?

What have you got

config.action_controller.action_on_unpermitted_parameters

set to?

I set it to :raise in test/development, so that submitting incorrect
parameters will cause tests to fail

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs