I've been puzzling over how to test that attr_accessible has been set
for the correct columns; but the tests I've come up with so far seem
to fail to fail when I expect. I came across this old message from
this list:

http://www.mail-archive.com/[email protected]/msg01570.html

Which seemed like a plausible example, but my attempt (modeled on the
example) doesn't work:

describe Article, 'protected attributes' do
     it 'should deny mass-assignment to the user_id' do
       lambda { article.update_attributes(:person_id =>  @person.id)
}.should raise_error
     end
end

The lambda doesn't raise an error, even though the attr_accessible
doesn't include person_id.

Where am I stumbling here? Is it my beginner's knowledge of rails, or
beginner's knowledge of Ruby?

Thanks,

Iain
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to