Testing strong parameters

Hi guys,

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.


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


LOL! Thx Dave.

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

Use permitters instead. Easily testable.

What have you got


set to?

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


Thx Fredrick! You’re a STAR!