Class: DestroyActionBaseTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- DestroyActionBaseTest
- Includes:
- UserTestHelper
- Defined in:
- lib/vendor/plugins/inherited_resources/test/base_test.rb
Instance Method Summary collapse
- #test_redirects_to_users_list ⇒ Object
- #test_show_flash_message_when_cannot_be_deleted ⇒ Object
- #test_show_flash_message_when_user_can_be_deleted ⇒ Object
- #test_the_requested_user_is_destroyed ⇒ Object
Methods included from UserTestHelper
Instance Method Details
#test_redirects_to_users_list ⇒ Object
218 219 220 221 222 223 |
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 218 def test_redirects_to_users_list User.stubs(:find).returns(mock_user(:destroy => true)) @controller.expects(:collection_url).returns('http://test.host/') delete :destroy assert_redirected_to 'http://test.host/' end |
#test_show_flash_message_when_cannot_be_deleted ⇒ Object
212 213 214 215 216 |
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 212 def User.stubs(:find).returns(mock_user(:destroy => false)) delete :destroy assert_equal flash[:error], 'User could not be destroyed.' end |
#test_show_flash_message_when_user_can_be_deleted ⇒ Object
206 207 208 209 210 |
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 206 def User.stubs(:find).returns(mock_user(:destroy => true)) delete :destroy assert_equal flash[:notice], 'User was successfully destroyed.' end |
#test_the_requested_user_is_destroyed ⇒ Object
199 200 201 202 203 204 |
# File 'lib/vendor/plugins/inherited_resources/test/base_test.rb', line 199 def test_the_requested_user_is_destroyed User.expects(:find).with('42').returns(mock_user) mock_user.expects(:destroy) delete :destroy, :id => '42' assert_equal mock_user, assigns(:user) end |