ruby on rails - RSpec controller test: How do I check @organization.destroy is being called? -


i thought might like:

let(:organization) { mock_model(organization).as_null_object }  before(:each)   organization.stub(:find).and_return(organization) end  "calls destroy action on @organization"   assigns[:organization].should_receive("destroy")   post :destroy, :id => organization.id end 

..but "can't modify frozen object" error.

here's how write spec:

describe 'oragnization#destroy'   let(:organization) { mock_model(organization, :id => 1, :destroy => true) }    subject { post :destroy, :id => organization.id }    { should be_successful } end 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -