我正在阅读 Michael Hartl 的 railstutorial 的第 11 章,并且遇到了一些 rspec 错误。
我不太确定错误消息的含义。
以防万一,这是我的规范代码。
let(:follower) {FactoryGirl.create(:user)}
let(:followed) {FactoryGirl.create(:user)}
let(:relationship) {follower.relationships.build(followed_id: followed_id)}
subject {relationship}
it {should be_valid}
describe "accessible attributes" do
it "should not allow access to follower_id" do
expect do
Relationship.new(follower_id: follower_id)
end.to raise_error(ActiveModel::MassAssignmentSecurity::Error)
end
end
任何帮助,将不胜感激。谢谢!