Sha256: c5d66c4fcd394647db1bf32fac8b34a9b7fbc7879d00f826effde07c0d1f54e4
Contents?: true
Size: 1.26 KB
Versions: 10
Compression:
Stored size: 1.26 KB
Contents
require 'test/helper' class Admin::PostsControllerTest < ActionController::TestCase def test_should_allow_admin_to_add_a_category admin = typus_users(:admin) @request.session[:typus_user_id] = admin.id assert admin.can_perform?('Post', 'create') end def test_should_not_allow_designer_to_add_a_post designer = typus_users(:designer) @request.session[:typus_user_id] = designer.id get :new assert_response :redirect assert_equal "Designer can't perform action. (new)", flash[:notice] assert_redirected_to :action => :index end def test_should_allow_admin_to_destroy_a_post admin = typus_users(:admin) @request.session[:typus_user_id] = admin.id get :destroy, { :id => posts(:published).id, :method => :delete } assert_response :redirect assert_equal "Post successfully removed.", flash[:success] assert_redirected_to :action => :index end def test_should_not_allow_designer_to_destroy_a_post designer = typus_users(:designer) @request.session[:typus_user_id] = designer.id get :destroy, { :id => posts(:published).id, :method => :delete } assert_response :redirect assert_equal "Designer can't delete this item.", flash[:notice] assert_redirected_to :action => :index end end
Version data entries
10 entries across 10 versions & 1 rubygems