Class: OauthClientsControllerUpdateTest

Inherits:
ActionController::TestCase
  • Object
show all
Includes:
OAuthControllerTestHelper
Defined in:
lib/generators/test_unit/templates/clients_controller_test.rb

Instance Method Summary collapse

Instance Method Details

#do_invalid_updateObject



254
255
256
257
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 254

def do_invalid_update
  @client_application.expects(:update_attributes).returns(false)
  put :update, :id=>'1', 'client_application' => {'name'=>'my site'}
end

#do_valid_updateObject



249
250
251
252
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 249

def do_valid_update
  @client_application.expects(:update_attributes).returns(true)
  put :update, :id => '1', 'client_application' => {'name'=>'my site'}
end

#setupObject



242
243
244
245
246
247
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 242

def setup
  @controller = OauthClientsController.new
  @request    = ActionController::TestRequest.new
  @response   = ActionController::TestResponse.new
  
end

#test_should_assign_client_applicationsObject



271
272
273
274
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 271

def test_should_assign_client_applications
  do_invalid_update
  assert_equal @client_application, assigns(:client_application)
end

#test_should_query_current_users_client_applicationsObject



259
260
261
262
263
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 259

def test_should_query_current_users_client_applications
  @user.expects(:client_applications).returns(@client_applications)
  @client_applications.expects(:find).with('1').returns(@client_application)
  do_valid_update
end

#test_should_redirect_to_new_client_applicationObject



265
266
267
268
269
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 265

def test_should_redirect_to_new_client_application
  do_valid_update
  assert_response :redirect
  assert_redirected_to :action => "show", :id => @client_application.id
end

#test_should_render_show_templateObject



276
277
278
279
# File 'lib/generators/test_unit/templates/clients_controller_test.rb', line 276

def test_should_render_show_template
  do_invalid_update
  assert_template('edit')
end