Sha256: 5a9347f6dd57577b92fd9369f869560428a86dd1e0f268035fef5c219a197c61
Contents?: true
Size: 1.99 KB
Versions: 3
Compression:
Stored size: 1.99 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' require 'public_holidays_controller' # Re-raise errors caught by the controller. class PublicHolidaysController; def rescue_action(e) raise e end; end class PublicHolidaysControllerTest < ActionController::TestCase fixtures :public_holidays def setup @controller = PublicHolidaysController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.session[:user_id] = 1000001 @first_id = public_holidays(: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(:public_holidays) end def test_show get :show, :id => @first_id assert_response :success assert_template 'show' assert_not_nil assigns(:public_holiday) assert assigns(:public_holiday).valid? end def test_new get :new assert_response :success assert_template 'new' assert_not_nil assigns(:public_holiday) end def test_create num_public_holidays = PublicHoliday.count post :create, :public_holiday => {:on => '2008-05-27'} assert_response :redirect assert_redirected_to :action => 'list' assert_equal num_public_holidays + 1, PublicHoliday.count end def test_edit get :edit, :id => @first_id assert_response :success assert_template 'edit' assert_not_nil assigns(:public_holiday) assert assigns(:public_holiday).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 { PublicHoliday.find(@first_id) } post :destroy, :id => @first_id assert_response :redirect assert_redirected_to :action => 'list' assert_raise(ActiveRecord::RecordNotFound) { PublicHoliday.find(@first_id) } end end
Version data entries
3 entries across 3 versions & 1 rubygems