Class: UpdateActionCustomizedBaseTest

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_redirect_to_the_created_userObject



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_savedObject



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_objectObject



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