Sha256: 0c948ac5e464a363c8719afceb63c66c6951b20c0ef7b998765260ff02c5fdd1
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class ControllerLoggedOutTest < ActionController::TestCase tests Admin::UsersController attr_reader :session def setup @request.session[:user_id] = nil post :destroy, :id => 1 end def test_should_not_be_successful assert_equal '401', @response.code end end class ControllerLoggedInTest < ActionController::TestCase tests Admin::UsersController attr_reader :session def setup @user = create_user @request.session[:user_id] = @user.id @role = create_role(:name => 'developer') create_role_permission(:role => @role, :permission => create_permission(:controller => 'admin/users')) end def test_should_be_successful_if_authorized create_role_assignment(:role => @role, :assignee => @user) post :destroy, :id => 1 assert_response :success end def test_should_not_be_successful_if_unauthorized post :destroy, :id => 1 assert_equal '401', @response.code end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
has_roles-0.3.1 | test/functional/application_controller_test.rb |
has_roles-0.3.0 | test/functional/application_controller_test.rb |