Class: OauthClientsControllerUpdateTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- OauthClientsControllerUpdateTest
- Includes:
- OAuthControllerTestHelper
- Defined in:
- lib/generators/test_unit/templates/clients_controller_test.rb
Instance Method Summary collapse
- #do_invalid_update ⇒ Object
- #do_valid_update ⇒ Object
- #setup ⇒ Object
- #test_should_assign_client_applications ⇒ Object
- #test_should_query_current_users_client_applications ⇒ Object
- #test_should_redirect_to_new_client_application ⇒ Object
- #test_should_render_show_template ⇒ Object
Instance Method Details
#do_invalid_update ⇒ Object
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_update ⇒ Object
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 |
#setup ⇒ Object
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 login_as_application_owner end |
#test_should_assign_client_applications ⇒ Object
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_applications ⇒ Object
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_application ⇒ Object
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_template ⇒ Object
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 |