Skip to content


Subversion checkout URL

You can clone with
Download ZIP


'should_not allow_mass_assignment_of' could pass if attribute is misspelled #156

monocle opened this Issue · 1 comment

2 participants


For example, if I have a model that's using attr_accessible,

it { should_not allow_mass_assignment_of :rememer_token }   # should be :remember_token

passes because the attribute doesn't exist. Perhaps the matcher should make sure that the subject responds to the attribute as part of the validation?


This would involve extending the context framework to allow special behavior for should_not. Otherwise, not having the attribute defined would actually cause any should_not blocks to pass.

I think it's better to just combine this with tests to make sure your attributes exist. If you're willing to submit a tested patch that adds does_not_match? to the context framework and a does_not_match? method to this matcher, I'd pull it in.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.