我想它可能是这样的:
let(:organization) { mock_model(Organization).as_null_object }
before(:each) do
Organization.stub(:find).and_return(organization)
end
it "calls the destroy action on @organization" do
assigns[:organization].should_receive("destroy")
post :destroy, :id => organization.id
end..but我收到"can't modify error“错误。
发布于 2011-07-03 05:18:55
下面是我将如何编写该规范:
describe 'Oragnization#destroy' do
let(:organization) { mock_model(Organization, :id => 1, :destroy => true) }
subject { post :destroy, :id => organization.id }
it { should be_successful }
endhttps://stackoverflow.com/questions/6559496
复制相似问题