Class: CreateActionCustomizedBaseTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- CreateActionCustomizedBaseTest
- Includes:
- CarTestHelper
- Defined in:
- lib/vendor/plugins/inherited_resources/test/customized_base_test.rb
Instance Method Summary collapse
- #test_expose_a_newly_create_user_when_saved_with_success ⇒ Object
- #test_redirect_to_the_created_user ⇒ Object
- #test_render_new_template_when_user_cannot_be_saved ⇒ Object
Methods included from CarTestHelper
Instance Method Details
#test_expose_a_newly_create_user_when_saved_with_success ⇒ Object
94 95 96 97 98 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 94 def test_expose_a_newly_create_user_when_saved_with_success Car.expects(:create_new).with({'these' => 'params'}).returns(mock_car(:save_successfully => true)) post :create, :car => {:these => 'params'} assert_equal mock_car, assigns(:car) end |
#test_redirect_to_the_created_user ⇒ Object
100 101 102 103 104 105 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 100 def test_redirect_to_the_created_user Car.stubs(:create_new).returns(mock_car(:save_successfully => true)) @controller.expects(:resource_url).returns('http://test.host/') post :create assert_redirected_to 'http://test.host/' end |
#test_render_new_template_when_user_cannot_be_saved ⇒ Object
107 108 109 110 111 112 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 107 def test_render_new_template_when_user_cannot_be_saved Car.stubs(:create_new).returns(mock_car(:save_successfully => false, :errors => {:some => :error})) post :create assert_response :success assert_equal "New HTML", @response.body.strip end |