Sha256: 57f05984d5413b62f994287cf31439ea5a167501335d718053d459019829daf5

Contents?: true

Size: 1.08 KB

Versions: 19

Compression:

Stored size: 1.08 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
  main_scenario

  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 => 'welcome', :action => :index

    assert_equal count_before, Estimate.count
  end
  
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
backlog-0.25.0 test/functional/estimates_controller_test.rb
backlog-0.26.0 test/functional/estimates_controller_test.rb
backlog-0.28.0 test/functional/estimates_controller_test.rb
backlog-0.29.0 test/functional/estimates_controller_test.rb
backlog-0.30.0 test/functional/estimates_controller_test.rb
backlog-0.31.0 test/functional/estimates_controller_test.rb
backlog-0.31.1 test/functional/estimates_controller_test.rb
backlog-0.32.0 test/functional/estimates_controller_test.rb
backlog-0.33.0 test/functional/estimates_controller_test.rb
backlog-0.34.1 test/functional/estimates_controller_test.rb
backlog-0.33.1 test/functional/estimates_controller_test.rb
backlog-0.34.2 test/functional/estimates_controller_test.rb
backlog-0.35.0 test/functional/estimates_controller_test.rb
backlog-0.34 test/functional/estimates_controller_test.rb
backlog-0.35.1 test/functional/estimates_controller_test.rb
backlog-0.35.2 test/functional/estimates_controller_test.rb
backlog-0.35.3 test/functional/estimates_controller_test.rb
backlog-0.35.4 test/functional/estimates_controller_test.rb
backlog-0.35.5 test/functional/estimates_controller_test.rb