Sha256: ea9d31f0af6ec0f96ca4919a96ab7bc52716686c31a7572add7a73ea35d27bfd

Contents?: true

Size: 1.17 KB

Versions: 28

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'estimates_controller'

class EstimatesController; def rescue_action(e) raise e end; end

class EstimatesControllerTest < Test::Unit::TestCase
  fixtures :parties, :users, :groups, :groups_users, :backlogs, :periods, :tasks, :task_files, :works, :estimates

  def setup
    @controller = EstimatesController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new

    @request.session[:user_id] = 1000001
  end
  
  def test_create
    count_before = Estimate.count
    post :create, "id"=>tasks(:first).id, "estimate"=>{"todo"=>"0"}
    
    assert_response :redirect
    assert_redirected_to :controller => 'periods', :action => :show, :id => tasks(:first).period_id, :task_id => 1

    assert_equal count_before +1 , Estimate.count
  end
  
  def test_create_get_is_redirected_to_root
    count_before = Estimate.count
    get :create,
        "action"=>"create", 
        "id"=>"1", 
        "estimate"=>{"todo"=>"0"}
    
    assert_response :redirect
    assert_redirected_to :controller => 'backlogs', :action => :index

    assert_equal count_before, Estimate.count
  end
  
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
backlog-0.14.3 test/functional/estimates_controller_test.rb
backlog-0.14.4 test/functional/estimates_controller_test.rb
backlog-0.15.0 test/functional/estimates_controller_test.rb
backlog-0.15.1 test/functional/estimates_controller_test.rb
backlog-0.16.0 test/functional/estimates_controller_test.rb
backlog-0.17.0 test/functional/estimates_controller_test.rb
backlog-0.17.1 test/functional/estimates_controller_test.rb
backlog-0.17.2 test/functional/estimates_controller_test.rb