Class: OauthClientsControllerCreateTest
- Inherits:
-
ActionController::TestCase
- Object
- ActionController::TestCase
- OauthClientsControllerCreateTest
- Includes:
- OAuthControllerTestHelper
- Defined in:
- lib/generators/test_unit/templates/clients_controller_test.rb
Instance Method Summary collapse
- #do_invalid_post ⇒ Object
- #do_valid_post ⇒ 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_post ⇒ Object
175 176 177 178 |
# 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 ⇒ Object
170 171 172 173 |
# 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 ⇒ Object
160 161 162 163 164 165 166 167 168 |
# 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 ⇒ Object
191 192 193 194 |
# 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 ⇒ Object
180 181 182 183 |
# 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 ⇒ Object
185 186 187 188 189 |
# 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 ⇒ Object
196 197 198 199 |
# 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 |