Sha256: 70850892877e1a0c0e013f93bd1548e0fabf2aa7f3c3c3636edcd65f13ee6a6d

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require "test_helper"

class Admin::PostsControllerTest < ActionController::TestCase

  should "render index" do
    get :index
    assert_response :success
    assert_template 'index'
  end

  should "render new" do
    get :new
    assert_response :success
    assert_template 'new'
  end

  should "create" do
    assert_difference 'Post.count' do
      post :create, { :post => { :title => 'This is another title', :body => 'Body' } }
      assert_response :redirect
      assert_redirected_to :controller => 'admin/posts', :action => 'edit', :id => Post.last
    end
  end

  should "render show" do
    get :show, { :id => Factory(:post).id }
    assert_response :success
    assert_template 'show'
  end

  should "render edit" do
    get :edit, { :id => Factory(:post).id }
    assert_response :success
    assert_template 'edit'
  end

  should "update" do
    _post = Factory(:post)
    post :update, { :id => _post.id, :title => 'Updated' }
    assert_response :redirect
    assert_redirected_to :controller => 'admin/posts', :action => 'edit', :id => _post.id
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typus-1.0.0.pre8 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre7 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre6 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre5 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre4 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre3 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre2 test/functional/admin/resources_controller_posts_crud_test.rb
typus-1.0.0.pre test/functional/admin/resources_controller_posts_crud_test.rb