Sha256: 6939d5027c96f6251463dd5c3d7420870717938f12e235bc19fefa676a746dfe
Contents?: true
Size: 1.59 KB
Versions: 19
Compression:
Stored size: 1.59 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' describe Admin::PostsController do before :each do Blog.destroy_all @blog = Blog.make @post = Post.make @blog.posts << @post @blog.save end it 'gets index action' do get :index, :blog_id => @blog.id response.should render_template(:index) end it 'gets show action' do get :show, :blog_id => @blog.id, :id => @post.id response.should render_template(:show) end it 'gets new action' do get :new, :blog_id => @blog.id response.should render_template(:new) end it 'posts create action and renders new template when model is invalid' do Post.any_instance.stubs(:save).returns(false) post :create, :blog_id => @blog.id response.should render_template(:new) end it 'posts create action and redirects' do post :create, :blog_id => @blog.id, :post => Post.plan response.should be_redirect end it 'gets edit action' do get :edit, :blog_id => @blog.id, :id => @post.id response.should render_template(:edit) end it 'puts update action and renders edit template when model is invalid' do Post.any_instance.stubs(:save).returns(false) put :update, :blog_id => @blog.id, :id => @post.id response.should render_template(:edit) end it 'puts update action and redirects' do Post.any_instance.stubs(:save).returns(true) put :update, :blog_id => @blog.id, :id => @post.id response.should be_redirect end it 'deletes destroy action and redirects' do delete :destroy, :blog_id => @blog.id, :id => @post.id response.should be_redirect end end
Version data entries
19 entries across 19 versions & 1 rubygems