Sha256: 622fc93e26614ea3f5b7764fa10c5d726713cf67541ec9611dc394dd8d22d3d6
Contents?: true
Size: 1.32 KB
Versions: 25
Compression:
Stored size: 1.32 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' describe Admin::BlogsController do before :each do @blog = Blog.new Blog.stubs(:find).returns(@blog) Blog.any_instance.stubs(:save).returns(true) Blog.any_instance.stubs(:to_param).returns('1') end it 'gets index action' do Blog.stubs(:find).returns([@blog]) get :index response.should render_template(:index) end it 'gets show action' do get :show, :id => 1 response.should render_template(:show) end it 'gets new action' do get :new response.should render_template(:new) end it 'posts create action and renders new template when model is invalid' do Blog.any_instance.stubs(:save).returns(false) post :create response.should render_template(:new) end it 'posts create action and redirects' do post :create response.should be_redirect end it 'gets edit action' do get :edit, :id => 1 response.should render_template(:edit) end it 'puts update action and renders edit template when model is invalid' do Blog.any_instance.stubs(:save).returns(false) put :update, :id => 1 response.should render_template(:edit) end it 'puts update action and redirects' do Blog.any_instance.stubs(:save).returns(true) put :update, :id => 1 response.should be_redirect end end
Version data entries
25 entries across 25 versions & 1 rubygems