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

Version Path
blog_logic-1.4.0 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.3.1 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.3.0 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.2.4 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.2.3 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.2.2 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.2.1 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.2.0 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.9 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.8 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.7 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.6 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.5 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.4 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.3 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.2 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.1 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.1.0 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-1.0.0 spec/controllers/admin/blogs_controller_spec.rb
blog_logic-0.7.7 spec/controllers/admin/blogs_controller_spec.rb