let(:admin) { FactoryGirl.create(:admin) }
This is normal as you have it (in spec / factories.rb)
factory :admin do admin true end
But for now in /user.rb models:
attr_accessible :name, :email, :password, :password_confirmation
My bet is that the factory girl uses the mass assignment to set: admin => true, which is then discarded by attr_accessible.
But more importantly, how do you debug it? By asking "what's going on?" and "what am I expecting?" and variations on it until you find that the answers to both questions are in the middle. In this case, the questions I'm starting with are: what does this make the link display? Is this true for the model I created in the spec? Is the spec a hit on the pages I expect? Is the model the same when I hit the page with a browser, as it is in the spec?
But all this is just a variation of "what is happening?" and "What am I expecting?"
Iain source share