test/functional/estimates_controller_test.rb in backlog-0.7.2 vs test/functional/estimates_controller_test.rb in backlog-0.7.3
- old
+ new
@@ -1,18 +1,41 @@
require File.dirname(__FILE__) + '/../test_helper'
require 'estimates_controller'
-# Re-raise errors caught by the controller.
class EstimatesController; def rescue_action(e) raise e end; end
class EstimatesControllerTest < Test::Unit::TestCase
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,
+ "action"=>"create",
+ "id"=>"1",
+ "estimate"=>{"todo"=>"0"}
+
+ assert_response :redirect
+ assert_redirected_to :controller => 'periods', :action => :show, :id => 1, :task_id => 1
- # Replace this with your real tests.
- def test_truth
- assert true
+ 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