class OauthClientsControllerCreateTest

Public Instance Methods

do_invalid_post() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 175
def do_invalid_post
  @client_application.expects(:save).returns(false)
  post :create,:client_application=>{:name=>'my site'}
end
do_valid_post() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 170
def do_valid_post
  @client_application.expects(:save).returns(true)
  post :create,'client_application'=>{'name'=>'my site'}
end
setup() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 160
def setup
  @controller = OauthClientsController.new
  @request    = ActionController::TestRequest.new
  @response   = ActionController::TestResponse.new

  login_as_application_owner
  @client_applications.stubs(:build).returns(@client_application)
  @client_application.stubs(:save).returns(true)
end
test_should_assign_client_applications() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 191
def test_should_assign_client_applications
  do_invalid_post
  assert_equal @client_application, assigns(:client_application)
end
test_should_query_current_users_client_applications() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 180
def test_should_query_current_users_client_applications
  @client_applications.expects(:build).returns(@client_application)
  do_valid_post
end
test_should_redirect_to_new_client_application() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 185
def test_should_redirect_to_new_client_application
  do_valid_post
  assert_response :redirect
  assert_redirected_to(:action => "show", :id => @client_application.id)
end
test_should_render_show_template() click to toggle source
# File lib/generators/test_unit/templates/clients_controller_test.rb, line 196
def test_should_render_show_template
  do_invalid_post
  assert_template('new')
end