aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
Commit message (Collapse)AuthorAgeFilesLines
...
| * Removed `model_name` method to prevent warningAndrew White2017-02-211-0/+1
| |
| * Support mapping of non-model classesAndrew White2017-02-211-0/+23
| |
| * Raise an error if `direct` is inside a scope blockAndrew White2017-02-211-0/+12
| |
| * Add custom polymorphic mappingAndrew White2017-02-211-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => <a href="/basket">Basket</a> More importantly it will generate the correct url when used with `form_for`. Fixes #1769.
| * Add test for calling a url helper in Mapper#directAndrew White2017-02-211-0/+7
| |
| * Only accept symbols and strings for Mapper#directAndrew White2017-02-211-0/+17
| |
| * Rename url_helper to directAndrew White2017-02-211-12/+12
| |
| * Add support for defining custom url helpers in routes.rbAndrew White2017-02-211-0/+121
| | | | | | | | | | | | | | | | | | | | | | Allow the definition of custom url helpers that will be available automatically wherever standard url helpers are available. The current solution is to create helper methods in ApplicationHelper or some other helper module and this isn't a great solution since the url helper module can be called directly or included in another class which doesn't include the normal helper modules. Reference #22512.
| * Merge pull request #28081 from meinac/fix_redirect_methodGuillermo Iguaran2017-02-211-2/+2
| |\ | | | | | | Use `response#location` instead of `#location` in redirect.
| | * Use `response#location` instead of `#location` in redirect.Mehmet Emin INAC2017-02-201-2/+2
| | | | | | | | | | | | Closes #28033
| * | Fix default host in setup, move teardown to helper fileeileencodes2017-02-201-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Override integration test default host Integration tests automatically set the default host to 'http://example.com'. This works fine for integration tests because they are not real browser sessions, but doesn't work fine for system tests because they are real browser sessions. We can override this by setting the `host!` in `before_setup. The `Capybara.always_include_port` will allow the test to look at `127.0.0.1:port capybara picks` and properly redirect the test. Any application can override this by setting the `host!` in their system test helper. Generally though, applications are going to be using localhost. In this commit I also moved the setup and teardown into their own module for tidiness. * Move teardown settings into system test case These configuration options can be put into the system test case file instead of the generated system tests helper file. This is an implementation detail and therefore shouldn't be generated with the template.
| * | Fix screenshot helper to provide correct file nameeileencodes2017-02-201-1/+9
| | | | | | | | | | | | | | | We only want the file name to include the word `failures` if it failed, not any time the user wants to take a screenshot during a test run.
| * | Move and rename system testseileencodes2017-02-205-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move system tests back into Action Pack * Rename `ActionSystemTest` to `ActionDispatch::SystemTestCase` * Remove private base module and only make file for public `SystemTestCase` class, name private module `SystemTesting` * Rename `ActionSystemTestCase` to `ApplicationSystemTestCase` * Update corresponding documentation and guides * Delete old `ActionSystemTest` files
| * | Turn system testing into it's own gem and renameeileencodes2017-02-205-131/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renames `Rails::SystemTestCase` to `ActionSystemTest` and moves it to a gem under the Rails name. We need to name the class `ActionSystemTestCase` because the gem expects a module but tests themselves expect a class. Adds MIT-LICENSE, CHANGELOG, and README for the future.
| * | Appease Rubocopeileencodes2017-02-204-6/+6
| | | | | | | | | | | | Rubocop / code climate don't like single quotes and prefer doubles.
| * | Refactor so all drivers use Puma by defaulteileencodes2017-02-201-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Puma is the default webserver of Rails. Because of this it doesn't make sense to run tests in Webkit if the default server is Puma. Here I've refactored the webserver to be it's own standalone module so it can be shared between Rails' selenium default driver and Capybara's defaut drivers.
| * | Add support for screenshotseileencodes2017-02-201-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds support, tests, and documentation for the screenshot helper. If taking screenshots is supported by the driver (for example Rack Test doesn't support screenshots) then a screenshot will be taken if the test fails.
| * | Reconfigure how the drivers workeileencodes2017-02-204-42/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the useless Rack Test Driver that Rails was providing and moves to a shim like approach for default adapters. If someone wants to use one of the default Capybara Drivers then we will initialize a new `CapybaraDriver` that simply sets the default driver. Rails though is much more opinionated than Capybara and to make system testing a "works out of the box" framework in Rails we have the `RailsSeleniumDriver`. This driver sets defaults that Rails deems important for selenium testing. The purpose of this is to simply add a test and it just works.
| * | Add tests for system testingeileencodes2017-02-204-0/+104
| |/ | | | | | | | | | | | | | | | | | | * Adds test case test * Adds driver adapter test * Adds tests for capybara seleium driver (testing the settings not actually opening the browser to test capybara w/ selenium because that would so so so slow) * Adds tests for rack test driver * Adds tests for generators
| * Set correct "routes" in tests casesbogdanvlviv2017-02-201-3/+3
| |
* | Fixes CodeClimate warningsLeonel Galan2017-02-131-2/+2
| |
* | Use of ParameterFilter no longer forces `request.filtered_parameters' class ↵Leonel Galan2017-02-131-0/+13
|/ | | | | | | | | | to be Hash - Fixes issue described on #27944 - `filtered_query_string` used an Array representation of what semantically is a key value pair: better suited for a Hash. Without this change `filtered_params = original_params.class.new` returns an Array with unintended consequences.
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-123-3/+0
| | | | empty lines
* Correct spellingBenjamin Fleischer2017-02-054-4/+4
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Properly escape test namesAkira Matsuda2017-02-021-3/+3
| | | | since the test names become Regexp filters, non-escaped test names cause RegexpError on isolated test via bin/test
* Remove deprecated callbacks from ActionDispatch middlewaresRafael Mendonça França2017-01-312-101/+46
|
* Delete PATH_INFO after each controller test requestDominic Cleal2017-01-231-0/+14
| | | | | | | | | | Prevents PATH_INFO from being used to infer the request format in later test requests when no explicit format is given. As the request PATH_INFO may be set before a request, it can't be deleted during pre-request scrubbing. Fixes #27774
* Use ActionDispatch::IntegrationTest http helper methodsAndrew White2017-01-181-45/+41
| | | | | | | | Mixing Rack::Test::Methods into ActionDispatch::IntegrationTest seems to trigger Ruby bug 13107[1]. By using our methods instead of rack-test we shouldn't trigger the bug in Forwardable. [1]: https://bugs.ruby-lang.org/issues/13107
* :warning: "Use assert_nil if expecting nil. This will fail in MT6."Akira Matsuda2017-01-181-1/+5
|
* :warning: "Use assert_nil if expecting nil. This will fail in MT6."Akira Matsuda2017-01-182-10/+22
| | | | | | These are followups for 307065f959f2b34bdad16487bae906eb3bfeaf28, but TBH I'm personally not very much confortable with this style. Maybe we could override assert_equal in our test_helper not to warn?
* Fix all rubocop violationsRafael Mendonça França2017-01-171-1/+1
|
* Don't pollute Object with rubinius_skip and jruby_skipAkira Matsuda2017-01-171-9/+9
| | | | we call them only in the tests
* Merge pull request #27692 from y-yagi/make_render_work_with_ac_paramsEileen M. Uchitelle2017-01-161-1/+0
|\ | | | | make `render` work with AC::Params
| * make `render` work with AC::Paramsyuuji.yaginuma2017-01-151-1/+0
| | | | | | | | | | | | | | | | In 4.2, since AC::Params inherited `Hash`, processing in the case of `Hash` was done. But in 5.x, since AC::Params does not inherit `Hash`, need to add care for AC::Params. Related to 00285e7cf75c96553719072a27c27e4ab7d25b40
* | Added test to ensure that we dont break #to_h again when trying to restore ↵David Heinemeier Hansson2017-01-161-0/+5
| | | | | | | | the speed-up from 26dd9b26ab7317f94fd285245879e888344143b2 (cc: @fxn)
* | Revert "significant speedup of AC::Parameters#permit" ↵David Heinemeier Hansson2017-01-161-5/+0
|/ | | | [26dd9b26ab7317f94fd285245879e888344143b2] as it broke Parameters#to_h on at least fields_for-style nested params.
* Small spelling errorLachlan Priest2017-01-141-4/+4
| | | existing_acrnoyms -> existing_acronyms
* class Foo < Struct.new(:x) creates an extra unneeded anonymous classAkira Matsuda2017-01-131-2/+2
| | | | because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-122-2/+2
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Merge pull request #27610 from Envek/fix_and_speed_up_duration_parsingAndrew White2017-01-121-1/+1
|\ | | | | Fix inconsistent parsing of Durations with both months and years
| * Fix inconsistent results when parsing large durations and constructing ↵Andrey Novikov2017-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | durations from code ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true Duration parsing made independent from any moment of time: Fixed length in seconds is assigned to each duration part during parsing. Changed duration of months and years in seconds to more accurate and logical: 1. The value of 365.2425 days in Gregorian year is more accurate as it accounts for every 400th non-leap year. 2. Month's length is bound to year's duration, which makes sensible comparisons like `12.months == 1.year` to be `true` and nonsensical ones like `30.days == 1.month` to be `false`. Calculations on times and dates with durations shouldn't be affected as duration's numeric value isn't used in calculations, only parts are used. Methods on `Numeric` like `2.days` now use these predefined durations to avoid duplicating of duration constants through the codebase and eliminate creation of intermediate durations.
* | Revert "Merge pull request #27586 from maclover7/jm-fix-27584"Rafael Mendonça França2017-01-111-9/+0
| | | | | | | | | | | | | | This reverts commit 5eff7a9ca7bb2ee7f16db1ab4d11cebe28757ba5, reversing changes made to 5f03172f54a58a57a48a3121562beb2cef866cbe. Reason: It caused a regression. The test case is on the PR.
* | Use Encoding::UTF_8 constant for default_{internal,external} in the testsAkira Matsuda2017-01-111-2/+2
|/
* Update `cookies` helper on all HTTP requestsJon Moss2017-01-051-0/+9
| | | | | | | | | Regression introduced by ae29142142324545a328948e059e8b8118fd7a33 / 8363b879fe759f0645179f4521cc64795efbee6e. Previously, cookies were only updated on `GET` requests. Now we will update the helper for all requests, as part of `process`. Added regression tests for all available HTTP method helpers in `ActionController::TestCase`.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-053-4/+4
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Fix style guide violationsRafael Mendonça França2017-01-051-3/+3
|
* fix with_routing when testing api only controllersJulia López2016-12-291-0/+24
|
* Use `next` instead of `break`; avoid terminating whole loopJon Moss2016-12-291-0/+21
| | | | | | | | | | | | | | We want to avoid terminating the whole loop here, because it will cause parameters that should be removed to not be removed, since we are terminating early. In this specific case, `param2` is processed before `param1` due to the reversing of `route.parts`, and since `param2` fails the check on this line, it would previously cause the whole loop to fail, and `param1` would still be in `parameterized_parts`. Now, we are simply calling `next`, which is the intended behavior. Introduced by 8ca8a2d773b942c4ea76baabe2df502a339d05b1. Fixes #27454.
* Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-282-2/+2
| | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* Optimize Journey::Route#scoreBen Hughes2016-12-281-1/+1
| | | | | | | | Scoring routes based on constraints repeated many type conversions that could be performed in the outer loop. Determinations of score and fitness also used Array operations that required allocations. Against my benchmark with a large routeset, this reduced object allocations by over 30x and wall time by over 3x.