Hi
I am using Mongoid. In Mongoid while saving a record we typically give
like in the controller
@post.safely.save
For a model class Post
I am writing rspecs for my controller and want to mock the model. So
what I am doing is
let(:post) { mock_model(Post).as_null_object }
before(:each) do
Post.stub(:new).and_return(post)
end
it “creates new post”
Post.should_receive(:new).and_return(post)
end
#how do I stub safely.save also here and test whether it receives save
call?
Thanks
Arun