Sha256: b7a55133c37c21dc820c3e89c5f569c3bdbde84798da9fb2c1d5beedfcdff5e8

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class CategoriesControllerTest < ActionController::TestCase
  fixtures :categories, :users, :roles

  def test_should_get_index
    login_as :admin
    get :index
    assert_response :success
    assert assigns(:categories)
  end

  def test_should_get_new
    login_as :admin
    get :new
    assert_response :success
  end
  
  def test_should_create_category
    login_as :admin
    assert_difference Category, :count, 1 do
      post :create, :category => {:name => "Test Category"}
    end    
    assert_redirected_to category_path(assigns(:category))
  end

  def test_should_show_category
    get :show, :id => 1
    assert_response :success
  end

  def test_should_get_edit
    login_as :admin
    get :edit, :id => 1
    assert_response :success
  end
  
  def test_should_update_category
    login_as :admin
    put :update, :id => 1, :category => { }
    assert_redirected_to category_path(assigns(:category))
  end
  
  def test_should_destroy_category
    login_as :admin
    assert_difference Category, :count, -1 do
      delete :destroy, :id => 1
    end
    assert_redirected_to categories_path
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
community_engine-2.3.2 test/functional/categories_controller_test.rb
community_engine-2.3.1 test/functional/categories_controller_test.rb
community_engine-2.3.0 test/functional/categories_controller_test.rb
community_engine-2.1.0 test/functional/categories_controller_test.rb
community_engine-2.0.0 test/functional/categories_controller_test.rb