Sha256: 631ee634ddb2b8bd0f6c56397ebd7eaf0720b359dbafe3796a3b01e77532a693
Contents?: true
Size: 1.95 KB
Versions: 31
Compression:
Stored size: 1.95 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' require 'work_locks_controller' # Re-raise errors caught by the controller. class WorkLocksController; def rescue_action(e) raise e end; end class WorkLocksControllerTest < Test::Unit::TestCase fixtures :work_locks def setup @controller = WorkLocksController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.session[:user_id] = 1000001 @first_id = work_locks(:one).id end def test_index get :index assert_response :success assert_template 'list' end def test_list get :list assert_response :success assert_template 'list' assert_not_nil assigns(:work_locks) end def test_show get :show, :id => @first_id assert_response :success assert_template 'show' assert_not_nil assigns(:work_lock) assert assigns(:work_lock).valid? end def test_new get :new assert_response :success assert_template 'new' assert_not_nil assigns(:work_lock) end def test_create num_work_locks = WorkLock.count post :create, :work_lock => {:user_id => '1000001', :start_on => '2008-01-28', :end_on => '2008-01-28'} assert_response :redirect assert_redirected_to :action => 'list' assert_equal num_work_locks + 1, WorkLock.count end def test_edit get :edit, :id => @first_id assert_response :success assert_template 'edit' assert_not_nil assigns(:work_lock) assert assigns(:work_lock).valid? end def test_update post :update, :id => @first_id assert_response :redirect assert_redirected_to :action => 'show', :id => @first_id end def test_destroy assert_nothing_raised { WorkLock.find(@first_id) } post :destroy, :id => @first_id assert_response :redirect assert_redirected_to :action => 'list' assert_raise(ActiveRecord::RecordNotFound) { WorkLock.find(@first_id) } end end
Version data entries
31 entries across 31 versions & 1 rubygems