Class: DestroyActionCustomizedBaseTest

Inherits:
ActionController::TestCase
  • Object
show all
Includes:
CarTestHelper
Defined in:
lib/vendor/plugins/inherited_resources/test/customized_base_test.rb

Instance Method Summary collapse

Methods included from CarTestHelper

#setup

Instance Method Details

#test_show_flash_message_when_cannot_be_deletedObject



156
157
158
159
160
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 156

def test_show_flash_message_when_cannot_be_deleted
  Car.stubs(:get).returns(mock_car(:destroy_successfully => false))
  delete :destroy
  assert_equal flash[:error], 'Car could not be destroyed.'
end

#test_show_flash_message_when_user_can_be_deletedObject



150
151
152
153
154
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 150

def test_show_flash_message_when_user_can_be_deleted
  Car.stubs(:get).returns(mock_car(:destroy_successfully => true))
  delete :destroy
  assert_equal flash[:notice], 'Car was successfully destroyed.'
end

#test_the_requested_user_is_destroyedObject



143
144
145
146
147
148
# File 'lib/vendor/plugins/inherited_resources/test/customized_base_test.rb', line 143

def test_the_requested_user_is_destroyed
  Car.expects(:get).with('42').returns(mock_car)
  mock_car.expects(:destroy_successfully)
  delete :destroy, :id => '42'
  assert_equal mock_car, assigns(:car)
end