Follow Along as I Stumble on the Path to Learning RoR

Checking Field Values When Posting in RSpec Controller

I was having trouble figuring out how to check that field values posted in RSpec Controller specs.  In models, I will usually do something like:

@foo.reload.name.should eq “bar”

However, that doesn’t work in Controller specs – it doesn’t recognize reload.

In that case, all you have to do is:

assigns[:foo].name.should eq “bar”

Advertisements

Comments are closed.