Sha256: 0103b597f43de4738686d5396c91ca6e92a1631790799e014ffb42e989b5ac88
Contents?: true
Size: 1.72 KB
Versions: 17
Compression:
Stored size: 1.72 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' require 'periods_controller' # Re-raise errors caught by the controller. class PeriodsController; def rescue_action(e) raise e end; end class PeriodsControllerTest < Test::Unit::TestCase fixtures :periods, :tasks, :works, :estimates def setup @controller = PeriodsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.session[:user_id] = 1000001 end def test_index get :index assert_response :redirect assert_redirected_to :action => :show, :id => 1 end def test_show get :show, :id => 1 assert_response :success assert_template 'show' assert_not_nil assigns(:period) assert assigns(:period).valid? end def test_new get :new assert_response :success assert_template 'new' assert_not_nil assigns(:period) end def test_create num_periods = Period.count post :create, :period => {:party_id => 1, :start_on => '2007-06-11', :end_on => '2007-06-24'} assert_response :redirect assert_redirected_to :action => :show, :id => 2 assert_equal num_periods + 1, Period.count end def test_edit get :edit, :id => 1 assert_response :success assert_template 'edit' assert_not_nil assigns(:period) assert assigns(:period).valid? end def test_update post :update, :id => 1 assert_response :redirect assert_redirected_to :action => 'show', :id => 1 end def test_destroy assert_not_nil Period.find(1) post :destroy, :id => 1 assert_response :redirect assert_redirected_to :action => :index assert_raise(ActiveRecord::RecordNotFound) { Period.find(1) } end end
Version data entries
17 entries across 17 versions & 1 rubygems