aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
Commit message (Collapse)AuthorAgeFilesLines
...
| * Wrap routes.url_helpers.url_for via a proxyAndrew White2017-02-211-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | The singleton url_for on Rails.application.routes.url_helpers isn't the same as the url_for you get when you include the module in your class as the latter has support for polymorphic style routes, etc. whereas the former accepts only a hash and is the underlying implementation defined on ActionDispatch::Routing::RouteSet. This commit changes the singleton method to call through a proxy instance so that it gets the full range of features specified in the documentation for url_for.
* | Add backticks around commandJon Moss2017-02-211-1/+1
|/ | | | [ci skip]
* Tiny documentation edits [ci skip]Robin Dupret2017-02-211-1/+1
|
* Fix some grammar in docs [ci skip]kenta-s2017-02-211-1/+1
|
* Merge pull request #28081 from meinac/fix_redirect_methodGuillermo Iguaran2017-02-212-3/+3
|\ | | | | Use `response#location` instead of `#location` in redirect.
| * Use `response#location` instead of `#location` in redirect.Mehmet Emin INAC2017-02-202-3/+3
| | | | | | | | Closes #28033
* | Add missing spaceJon Moss2017-02-201-1/+1
| | | | | | | | [ci skip]
* | Add changelog for system testseileencodes2017-02-201-0/+8
| |
* | Clean up documentationeileencodes2017-02-201-9/+10
| | | | | | | | | | There were some grammar issues and incorrect information in the system tests documentation.
* | Rename system_test_helper -> application_system_test_caseeileencodes2017-02-202-22/+9
| | | | | | | | | | | | This renames the system test helper file to be application system test case to match what the rest of Rails does. In the future we should consider changing the test_helper to match.
* | Fix default host in setup, move teardown to helper fileeileencodes2017-02-204-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-202-3/+15
| | | | | | | | | | 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-2011-0/+313
| | | | | | | | | | | | | | | | | | | | * 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-2018-686/+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-2013-19/+18
| | | | | | | | Rubocop / code climate don't like single quotes and prefer doubles.
* | Refactor so all drivers use Puma by defaulteileencodes2017-02-205-43/+107
| | | | | | | | | | | | | | | | | | 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-206-2/+81
| | | | | | | | | | | | | | | | | | 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-2010-144/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 documentation for system testseileencodes2017-02-209-7/+173
| | | | | | | | | | | | | | | | | | | | * Document Rails::SystemTestCase * Document setting drivers with the configration options * Document using the getter/setter for driver adapters * Document the CapybaraRackTestDriver and defaults * Document the CapybaraSeleniumDriver and defaults * Document custom assertions provided by System Testing * Document custom form helpers provided by System Testing
* | Add tests for system testingeileencodes2017-02-205-0/+105
| | | | | | | | | | | | | | | | | | | | * 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
* | Fix Railtie to pass class when setting optionseileencodes2017-02-203-8/+12
| | | | | | | | | | | | | | | | | | This will clean up the railtie quite a bit, rather than passing a set of hash keys call the new class directly like we do with ActiveJob. Only call driver once when tests start rather than in every single test setup. This is more performant, and the other way was creating unnecessary calls.
* | Move SystemTesting::Base into SystemTestCaseeileencodes2017-02-202-13/+6
| | | | | | | | | | There's no real benefit to the using the `Base` class here because `SystemTestCase` is already a very small class.
* | Refactor to not include `capybara/rails`eileencodes2017-02-201-2/+13
| | | | | | | | | | | | | | Rails itself is not a Rails application so instead of including `capybara/rails` we should use the code in there to set up the test. The only reason capybara needs to include capybara/rails in the first place is because Rails didn't yet support it.
* | Refactor driver adapter getter/settereileencodes2017-02-202-5/+10
| | | | | | | | | | | | This makes it easier to ask the system test what driver adapter it is currently using, and makes it easier to change that setting when necessary.
* | Inherit from ActionDispatch::IntegrationTesteileencodes2017-02-201-2/+1
| | | | | | | | | | | | | | Integration tests already handle all the fancy url mapping we need to do so inherting from that allows us to not need to reinvent the wheel in terms of loading up the route handling required to use `visit users_path` over `visit /users`.
* | Add test assertion helperseileencodes2017-02-203-0/+34
| | | | | | | | | | Adds assertions that are not part of Capybara but may be useful to Rails users writing system tests.
* | Add configuration option for driver adaptereileencodes2017-02-203-4/+18
| | | | | | | | | | This allows any application to change the driver adapter based on the config settings in the test env.
* | Add ForHelper's for system testseileencodes2017-02-203-0/+39
| | | | | | | | | | These FormHelpers are selectors that aren't a capybara default but are considered useful for Rails applications.
* | Add configurable selenium driver for capybaraeileencodes2017-02-202-0/+80
| | | | | | | | | | | | | | This is not yet configurable but is the minimum required to make Capybara work with the Selenium driver. A lot of this will change as the tests get fleshed out and the initialization requirements will eventually be configurable via the application.
* | Add ability to run system tests via Capybaraeileencodes2017-02-206-0/+79
| | | | | | | | | | | | Capybara defaults to Rack Test for it's driver and works out of the box but this adds the headers and allows for future configurable adapters for system testing.
* | Add skeleton for Rails::SystemTestCaseeileencodes2017-02-201-0/+5
|/ | | | | | | This skelton is the bare minimum to get system tests to actually run in an application. This of course doesn't yet actually run a test but it is enough for `bin/rails test:system` to attempt to run files in `test/system` that inherit from `Rails::SystemTestCase`.
* Set correct "routes" in tests casesbogdanvlviv2017-02-201-3/+3
|
* Unfreeze interpolated string because it's useless.Stan Lo2017-02-191-1/+1
|
* Merge pull request #27926 from st0012/freeze-cache-instrument-nameRafael França2017-02-132-2/+2
|\ | | | | Freeze fragment cache related instrument name.
| * Freeze fragment cache related instrument name.Stan Lo2017-02-072-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | ActionMailer::Base#instrument_name and ActionController::Base#instrument_name will be frequently called once caching is enabled. So it's better to freeze them instead of create new string on every call. Also, the instrument name in #instrument_fragment_cache will usually be "write_fragment.action_controller" or "read_fragment.action_controller". So freezing them might also gain some performance improvement. We have done something like this in other places: https://github.com/rails/rails/blob/master/actionview/lib/action_view/template.rb#L348
* | Remove unused requireRyuta Kamizono2017-02-122-3/+0
| | | | | | | | | | | | These files are not using `strip_heredoc`. Closes #27976
* | Removed the `attribute_accessors` required file:Edouard CHIN2017-02-121-1/+0
| | | | | | | | - This file is no more needed, the call to `cattr_reader` were removed in https://github.com/rails/rails/commit/9e2948e750fa3f641f20adad4b4ecae89b35faa7#diff-c5146df11f35304765e9ceebed108f57L60 and https://github.com/rails/rails/commit/1fe0a1b5ebebb1372968606b85ce08b93bc145c8#diff-c5146df11f35304765e9ceebed108f57L99
* | Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-123-3/+0
|/ | | | empty lines
* Correct spellingBenjamin Fleischer2017-02-055-5/+5
| | | | | | | ``` 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-316-162/+57
|
* Merge pull request #27647 from Shopify/fully-eagerload-journeyRafael França2017-01-304-0/+28
|\ | | | | Fully initialize routes before the first request is handled
| * Fully initialize routes before the first request is handledJean Boussier2017-01-184-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time.
* | Change ActionView ERB Handler from Erubis to ErubiJeremy Evans2017-01-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Erubi offers the following advantages for Rails: * Works with ruby's --enable-frozen-string-literal option * Has 88% smaller memory footprint * Does no freedom patching (Erubis adds a method to Kernel) * Has simpler internals (1 file, <150 lines of code) * Has an open development model (Erubis doesn't have a public source control repository or bug tracker) * Is not dead (Erubis hasn't been updated since 2011) Erubi is a simplified fork of Erubis that contains just the parts that are generally needed (which includes the parts that Rails uses). The only intentional difference in behavior is that it does not include support for <%=== tags for debug output. That could be added to the ActionView ERB handler if it is desired. The Erubis template handler remains in a deprecated state so that code that accesses it directly does not break. It can be removed after Rails 5.1.
* | Delete PATH_INFO after each controller test requestDominic Cleal2017-01-232-0/+15
| | | | | | | | | | | | | | | | | | | | 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
* | Add examples for behaviour about redirection with and without options. Fixes ↵Vipul A M2017-01-211-0/+8
| | | | | | | | #27715 [ci skip] (#27730)
* | 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
| |