aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/test_case_test.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* set parameters as a query stringAaron Patterson2015-07-091-1/+1
| | | | | | We should convert request parameters to a query string, then let the request object parse that query string. This should give us results that are more similar to the real-world
* use JSON to communicate between the controller and the testsAaron Patterson2015-07-091-12/+12
|
* build and assign parameters rather than rely on mutationsAaron Patterson2015-07-081-3/+3
| | | | | We should assign parameters to the request object rather than mutate the hash that is returned by `query_parameters` or `request_parameters`
* request objects are no longer recycledAaron Patterson2015-07-081-6/+0
| | | | | | Instead of trying to manually clear out a request object, lets just allocate a new one. The rack ENV is reused and cleaned (still), but the request object is not.
* let the superclass build the request and responseAaron Patterson2015-07-081-5/+2
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Remove `assigns` and `assert_template`.Guo Xiang Tan2015-05-301-41/+0
|
* Deprecate `:nothing` option for render methodMehmet Emin İNAÇ2015-05-281-3/+3
| | | | `head` method works similar to `render` method with `:nothing` option
* Merge pull request #19808 from byroot/action-parameterRafael Mendonça França2015-05-271-0/+20
|\ | | | | [PoC] Stop shadowing parameters named `action`
| * Allow to parameters named `action` or `controller` from AC::TestCase helpersJean Boussier2015-04-181-0/+20
| |
* | Issue#17703 Test case for tempfile attributeSiva Gollapalli2015-04-161-0/+5
|/ | | | | | | | | | + To avoid regression I am adding this test case on action pack Changed to assert from assert_equal + Added msg to assertion Modified msg
* Fix default headers in test responsesJeremy Kemper2015-02-251-0/+46
| | | | | | | Fixes regression in #18423. Merge default headers for new responses, but don't merge when creating a response from the last session request. hat tip @senny :heart:
* Merge pull request #18771 from kirs/deprecate-xhrRafael Mendonça França2015-02-051-3/+18
|\ | | | | Migrating xhr methods to keyword arguments syntax
| * Migrating xhr methods to keyword arguments syntaxKir Shatrov2015-02-011-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | in `ActionController::TestCase` and `ActionDispatch::Integration` Old syntax: `xhr :get, :create, params: { id: 1 }` New syntax example: `get :create, params: { id: 1 }, xhr: true`
* | Merge pull request #18721 from sj26/pre-discard-flashAaron Patterson2015-02-011-0/+12
|\ \ | |/ |/| Pre-discard flash messages
| * Fix flash remaining after last flash deletedSamuel Cochran2015-01-291-0/+12
| | | | | | | | | | | | | | Inside a controller functional test after the last flash is deleted it still persists the flash because to_session_value is nil. We should delete it from the session when the serialized version is nil, same as the flash middleware.
* | Consistent usage of spaces in hashes across our codebaseRafael Mendonça França2015-01-291-14/+18
| |
* | Switch to kwargs in ActionController::TestCase and ActionDispatch::IntegrationKir Shatrov2015-01-291-87/+279
|/ | | | | | | | Non-kwargs requests are deprecated now. Guides are updated as well. `post url, nil, nil, { a: 'b' }` doesn't make sense. `post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
* Remove deprecated option `use_route` in controller testsRafael Mendonça França2015-01-041-25/+0
|
* Deprecate `use_route` in controller testsGodfrey Chan2014-11-231-2/+2
| | | | Reference #17453
* Test using `ActionController::TestCase` with enginesGodfrey Chan2014-11-231-0/+52
| | | | | | Reference #17453 [Godfrey Chan, Washington Luiz]
* Make sure assert_select can assert body tagRafael Mendonça França2014-11-181-0/+21
| | | | | | | | | This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13. Conflicts: actionpack/lib/action_controller/test_case.rb actionview/lib/action_view/test_case.rb
* Pass the route name explicitlyGodfrey Chan2014-11-101-0/+12
| | | | | | Follow up to 212057b9. Since that commit, we need to pass the `route_name` explicitly. This is one of the left-over cases that was not handled in that commit, which was causing `use_route` to be ignored in functional tests.
* Use Hash#each_key instead of Hash#keys.eachErik Michaels-Ober2014-09-291-1/+1
| | | | | | Hash#keys.each allocates an array of keys; Hash#each_key iterates through the keys without allocating a new array. This is the reason why Hash#each_key exists.
* Merge branch 'master' into loofahRafael Mendonça França2014-08-121-5/+6
|\ | | | | | | | | | | | | Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/integration_test.rb actionview/CHANGELOG.md
| * Fixes to TestCaseTest.Guo Xiang Tan2014-08-081-4/+5
| |
| * Fix spelling.Guo Xiang Tan2014-08-071-1/+1
| |
* | Merge pull request #11218 from kaspth/loofah-integrationRafael Mendonça França2014-07-101-179/+0
|\ \ | |/ |/| | | | | | | | | | | Loofah-integration Conflicts: actionpack/CHANGELOG.md actionview/CHANGELOG.md
| * Removed tag.rb since it has been deprecated.Timm2014-06-151-179/+0
| |
* | Remove symbolized_path_parameters.Guo Xiang Tan2014-07-021-3/+3
|/ | | | This pull request is a continuation of https://github.com/rails/rails/commit/925bd975 and https://github.com/rails/rails/commit/8d8ebe3d.
* Deprecate all *_filter callbacks in favor of *_action callbacksRafael Mendonça França2014-05-271-1/+1
| | | | | This is the continuation of the work started at 9d62e04838f01f5589fa50b0baa480d60c815e2c
* use symbol keys for path_parametersAaron Patterson2014-05-221-5/+5
|
* Fix controller test not resetting @_url_optionsTony Wooster2014-02-261-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4f2cd3e9 introduced a bug by reordering the call to `@controller.recycle!` above the call to `build_request_uri`. The impact of this was that the `@_url_options` cache ends up not being reset between building a request URI (occurring within the test controller) and the firing of the actual request. We encountered this bug because we had the following setup: class MinimumReproducibleController < ActionController::Base before_filter { @param = 'param' } def index render text: url_for(params) end def default_url_options { custom_opt: @param } end end def test_index get :index # builds url, then fires actual request end The first step in `get :index` in the test suite would populate the @_url_options cache. The subsequent call to `url_for` inside of the controller action would then utilize the uncleared cache, thus never calling the now-updated default_url_options. This commit fixes this bug calling recycle! twice, and removes a call to set response_body, which should no longer be needed since we're recycling the request object explicitly.
* Clear filtered request attributes between requests in testsAndrew White2014-01-271-0/+8
| | | | | | | | The request attributes filtered_parameters, filtered_env and filtered_path are memoized for performance reasons. However this can cause unusual behavior in tests where there are multiple calls to get, post, etc. Fixes #13803.
* Eliminate `JSON.{parse,load,generate,dump}` and `def to_json`Godfrey Chan2013-11-051-2/+3
| | | | | | | | | | | | | | | JSON.{dump,generate} offered by the JSON gem is not compatiable with Rails at the moment and can cause a lot of subtle bugs when passed certain data structures. This changed all direct usage of the JSON gem in internal Rails code to always go through AS::JSON.{decode,encode}. We also shouldn't be implementing `to_json` most of the time, and these occurances are replaced with an equivilent `as_json` implementation to avoid problems down the road. See [1] for all the juicy details. [1]: intridea/multi_json#138 (comment)
* Re-remove deprecated API.kennyj2013-06-281-7/+0
|
* Revert "Add the options method to action_controller testcase."Rafael Mendonça França2013-05-161-5/+0
| | | | | | | | | | | | This reverts commit 0303c2325fab253adf5e4a0b738cb469c048f008. Conflicts: actionpack/lib/action_controller/test_case.rb REASON: It will conflict with a lot of test cases. Better to call `process` directly since this is a very uncommon HTTP method. Fixes #10638.
* Fix rake test warnings in actionpackMack Earnhardt2013-03-171-1/+1
|
* `Http::Headers` directly modifies the passed environment.Yves Senn2013-03-151-0/+22
| | | | | | | | | The env hash passed to `Http::Headers#new` must be in env format. Also be aware that the passed hash is modified directly. docs and test-cases for setting headers/env in functional tests. Follow up to #9700.
* Change the behavior of route defaultsAndrew White2013-01-151-0/+31
| | | | | | | | | | | | | | | | | | | This commit changes route defaults so that explicit defaults are no longer required where the key is not part of the path. For example: resources :posts, bucket_type: 'posts' will be required whenever constructing the url from a hash such as a functional test or using url_for directly. However using the explicit form alters the behavior so it's not required: resources :projects, defaults: { bucket_type: 'projects' } This changes existing behavior slightly in that any routes which only differ in their defaults will match the first route rather than the closest match. Closes #8814
* deprecate `assert_blank` and `assert_present`.Yves Senn2013-01-051-1/+1
| | | | | They don't add any benefits over `assert object.blank?` and `assert object.present?`
* Use File.join to better integrate fixture_path in fixture_file_upload.Ben Woosley2012-11-261-0/+12
|
* Merge branch 'master' into testcleanAaron Patterson2012-07-051-0/+5
|\ | | | | | | | | | | | | | | | | | | * master: Add documentation for inheritance_column method Use ArgumentError vs. RuntimeError, which is more precise. CSV fixtures aren't supported by default anymore, update generated test_helper.rb to reflect that fix quoting for ActiveSupport::Duration instances Add few information on the field types Add the options method to action_controller testcase.
| * Add the options method to action_controller testcase.François de Metz2012-07-041-0/+5
| | | | | | | | Signed-off-by: François de Metz <francois@stormz.me>
* | test should be testing to_param not to_s, remove Array subclassAaron Patterson2012-07-031-2/+2
|/
* Don't paramify ActionDispatch::Http::UploadedFile in testsTim Vandecasteele2012-06-221-0/+7
| | | | | | | | | | To test uploading a file without using fixture_file_upload, a posted ActionDispatch::Http::UploadedFile should not be paramified (just like Rack::Test::UploadedFile). (Rack::Test::UploadedFile and ActionDispatch::Http::UploadedFile don't share the same API, tempfile is not accessible on Rack::Test::UploadedFile as discussed in https://github.com/brynary/rack-test/issues/30)
* Add failing test case for #6053Andrew White2012-04-291-0/+21
|
* Don't convert params if the request isn't HTML - fixes #5341Andrew White2012-04-291-2/+40
|
* Merge session arg with existing session instead of overwritingAndrew White2012-04-281-0/+20
| | | | | | | | | | | | | | | | | | | | | | | This may break existing tests that are asserting the whole session contents but should not break existing tests that are asserting individual keys - e.g: class SomeControllerTest < ActionController::TestCase setup do session['user_id'] = 1 end test "some test" do get :some_action, nil, { 'another_var' => 2 } # This assertion will now fail assert_equal({ 'another_var' => 2 }, session) # This assertion will still pass assert_equal 2, session['another_var] end end Fixes #1529.
* Remove default match without specified methodJose and Yehuda2012-04-241-5/+5
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* assigns(:foo) should not convert @foo's keys to strings if it happens to be ↵Will Bryant2012-02-181-0/+5
| | | | a hash