Class: UpdateActionCustomizedBaseTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- UpdateActionCustomizedBaseTest
- Includes:
- CarTestHelper
- Defined in:
- lib/vendor/plugins/inherited_resources/test/customized_base_test.rb
Instance Method Summary collapse
- #test_redirect_to_the_created_user ⇒ Object
- #test_render_edit_template_when_user_cannot_be_saved ⇒ Object
- #test_update_the_requested_object ⇒ Object
Methods included from CarTestHelper
Instance Method Details
#test_redirect_to_the_created_user ⇒ Object
125 126 127 128 129 130 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 125 def test_redirect_to_the_created_user Car.stubs(:get).returns(mock_car(:update_successfully => true)) @controller.expects(:resource_url).returns('http://test.host/') put :update assert_redirected_to 'http://test.host/' end |
#test_render_edit_template_when_user_cannot_be_saved ⇒ Object
132 133 134 135 136 137 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 132 def test_render_edit_template_when_user_cannot_be_saved Car.stubs(:get).returns(mock_car(:update_successfully => false, :errors => {:some => :error})) put :update assert_response :success assert_equal "Edit HTML", @response.body.strip end |
#test_update_the_requested_object ⇒ Object
118 119 120 121 122 123 |
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 118 def test_update_the_requested_object Car.expects(:get).with('42').returns(mock_car) mock_car.expects(:update_successfully).with({'these' => 'params'}).returns(true) put :update, :id => '42', :car => {:these => 'params'} assert_equal mock_car, assigns(:car) end |