aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit
Commit message (Collapse)AuthorAgeFilesLines
* Make generated test work even when using virtual attributesyuuji.yaginuma2019-05-051-2/+7
| | | | | | | | | The virtual attributes(`attachment` and `rich_text`) can't set value with `fill_in`. So avoid using it. Once #35885 is merged, will be modified to use it. Also, add checking attachment attached or not for avoiding `DelegationError` when attachment didn't attach.
* Add rich_text field to model generatorsChris Oliver2019-03-281-1/+1
|
* Fix links in gemspec and docs from http to https.Abhay Nikam2019-03-091-1/+1
|
* Fix warning: shadowing outer local variable - attributeRyuta Kamizono2018-12-131-1/+1
|
* Remove redundant suffixes on generated integration tests.Gannon McGibbon2018-12-121-0/+6
|
* Fix boolean interaction in scaffold system testsGannon McGibbon2018-12-122-0/+13
|
* Remove redundant suffixes on generated system tests.Gannon McGibbon2018-12-111-0/+5
|
* Generate the same value as a label of view in system test templateyuuji.yaginuma2018-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | In the system test template, enter a value based on label. However, since `label` method does not use `titleize` by default. If generate a value including underscore, cannot find a label and the test will fail. ``` $ ./bin/rails g scaffold user name:string phone_number:string $ ./bin/rails t test/system/users_test.rb E Error: UsersTest#test_creating_a_User: Capybara::ElementNotFound: Unable to find field "Phone Number" test/system/users_test.rb:18:in `block in <class:UsersTest>' ``` This removes unnecessary `titleize` so that the generated file will pass even if the attribute contains an underscore.
* Strip duplicated suffixes more strictlyRyuta Kamizono2018-04-222-2/+2
| | | | In the previous code incorrectly removes intermediate words.
* Fix duplicated suffix for JobGeneratorYoshiyuki Hirano2018-04-221-0/+5
|
* Allow `false` for `config.generators.system_tests=`bogdanvlviv2018-01-181-1/+1
| | | | | Mention `config.generators.system_tests` in the "Configuring Rails Applications" guide.
* Use .tt extension to all the template filesRafael Mendonça França2017-11-1314-1/+1
| | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* [Railties] require_relative => requireAkira Matsuda2017-10-2110-11/+11
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* Remove frozen_string_literal magic comment from templatesyuuji.yaginuma2017-09-1712-24/+0
| | | | Follow up of #30348
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-1422-0/+44
|
* [Railties] require => require_relativeAkira Matsuda2017-07-0110-11/+11
|
* Add system tests to generate scaffoldDinah Shi2017-06-304-8/+68
|
* Includes namespace in system test skelton when namespace is specifiedyuuji.yaginuma2017-05-281-1/+1
| | | | Fixes #29247
* Rename system_test_helper -> application_system_test_caseeileencodes2017-02-203-3/+3
| | | | | | 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-201-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Add default configuration to generated system test helpereileencodes2017-02-201-0/+2
| | | | | This serves as self documentation so users know how to change the driver.
* Move and rename system testseileencodes2017-02-202-4/+6
| | | | | | | | | | * 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
* Refactor config settings to use generated fileeileencodes2017-02-203-2/+14
| | | | | | | | | | | | | | | | | | | Originally I had set up system testing to have one configuration option to be set in the test environment. After thinking it over I think a generated class on app creation would be best. The reason for this is Capybara has a ton of configuration options that I'm sure some folks want to use. Thinking about how we handle screenshots, database transactions, and a whole bunch of other settings it would be better for users to be able to turn all of that on and off. When an app or scaffold is generated a `test/system_test_helper.rb` test helper will be generated as well. This will contain the class for tests to inherit from `ActionSystemTestCase` which will inherit from `ActionSystemTest::Base`. Here is where users can change the test driver, remove the screenshot helper, and add their additional Capybara configuration.
* Turn system testing into it's own gem and renameeileencodes2017-02-201-1/+1
| | | | | | | | | | 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-201-1/+1
| | | | Rubocop / code climate don't like single quotes and prefer doubles.
* Add generators and ability to run system testseileencodes2017-02-202-0/+20
| | | | | | | * Generates system test requirements with new Rails app * Includes required default gems in Gemfile for Rails app * Generates a single system test case * Generates a system test case with scaffold
* Add missing module namespacing wrapperShota Iguchi2017-02-151-0/+2
| | | | refs: #28011
* Fix generator command for nested (namespaced) rails engine (take 2)Fumiaki MATSUSHIMA2017-01-071-1/+1
| | | | | | | | | | | | | | | | | | | Rewrite https://github.com/rails/rails/pull/27550 085546df45 was reverted (b6ffb5efcb) because it change the return of `namespaced_path` from String to Array. ---------------- If we create nested (namespaced) rails engine such like bukkits-admin, `bin/rails g scaffold User name:string age:integer` will create `bukkits-admin/app/controllers/bukkits/users_controller.rb` but it should create `bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`. In #6643, we changed `namespaced_path` as root path because we supposed application_controller is always in root but nested rails engine's application_controller will not.
* Revert "Merge pull request #27550 from ↵Rafael Mendonça França2017-01-031-1/+1
| | | | | | | | | mtsmfm/fix-generator-command-for-nested-rails-engine" This reverts commit 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7, reversing changes made to a5041f267ded119c2d00b8786c2f2c1e3f93c8a1. Reason: It breaks the public API
* Fix generator command for nested (namespaced) rails engineFumiaki MATSUSHIMA2017-01-031-1/+1
| | | | | | | | | | | | | If we create nested (namespaced) rails engine such like bukkits-admin, `bin/rails g scaffold User name:string age:integer` will create `bukkits-admin/app/controllers/bukkits/users_controller.rb` but it should create `bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`. In #6643, we changed `namespaced_path` as root path because we supposed application_controller is always in root but nested rails engine's application_controller will not.
* Privatize unneededly protected methods in RailtiesAkira Matsuda2016-12-252-2/+2
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* applies new string literal convention in railties/libXavier Noria2016-08-069-23/+23
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix API controller tests by assigning them the encoding typePrathamesh Sonpatki2016-06-071-5/+5
| | | | | | | - Fixes #25183. - The `as: :json` feature was added in https://github.com/rails/rails/pull/21671 and recommended to use for JSON endpoints so let's use it by default for API controller tests.
* Redirects are to urls, not pathsDavid Heinemeier Hansson2016-05-281-3/+3
|
* Remove redundant regexp escapes in generatorsGadzhi Gadzhiev2016-03-081-1/+1
|
* set association name to generated fixtures if attribute is referenceyuuji.yaginuma2016-02-061-1/+1
| | | | | | | It has been changed to require `belongs_to` by default in Rails 5. Therefore in order to pass the controller test, have association of set to fixtures. Fixes #23384
* make generated controller test work correctlyyuuji.yaginuma2016-01-061-1/+1
| | | | | | | Since the `#file_name` that not consideration for the namespace, if generate a controller with a namespace, not the correct url helper generation, it had become an error to run the test. Modified to generate the correct url helper, even if it is produced a namespace with controller.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-12-201-2/+2
|\
| * remove extra spaces in fixtures doc partGaurav Sharma2015-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | ``` Every time when a fixture generate, it’s also generating improper doc. one: {} # column: value # two: {} # column: value ```
* | fix indentation of generated controller testyuuji.yaginuma2015-12-182-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` # before module Bukkits class UsersControllerTest < ActionDispatch::IntegrationTest include Engine.routes.url_helpers setup do @user = bukkits_users(:one) end ``` ``` # after module Bukkits class UsersControllerTest < ActionDispatch::IntegrationTest include Engine.routes.url_helpers setup do @user = bukkits_users(:one) end ```
* | Deal with leading CR when its not a mountable engineDavid Heinemeier Hansson2015-12-171-1/+1
| |
* | Update test generators to use ActionDispatch::IntegrationTestAbdelkader Boudih2015-12-153-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | In Rails 5.1 `ActionController::TestCase` will be moved out of Rails into it's own gem. Please use `ActionDispatch::IntegrationTest` going forward. This changes the generators to use `ActionDispatch::IntegrationTest` and the required URL setup (rather than symbols) for each of the controller actions. Updated fix to #22076.
* | Revert "Merge pull request #22569 from seuros/remove-test-case"eileencodes2015-12-133-17/+16
| | | | | | | | | | | | | | | | | | This reverts commit 9712a7a12b7f9e4dcef751ceda8a73c3f4beb11f, reversing changes made to 3e65c3d3886336e9145438cdeacaf4ebec6a48b8. Reverting because this caused test failures and while we have a followup branch there is still one failure that happens randomly and isn't straight forward to fix.
* | Controller generators should be creating IntegrationTest stubs instead of ↵Abdelkader Boudih2015-12-133-16/+17
|/ | | | ControllerTest
* make generated scaffold functional tests work inside API enginesyuuji.yaginuma2015-08-091-1/+4
| | | | | * set engine's route in setup * use fixture with engine namespace
* fix NoMethodError that occurs when generating scaffold inside full mode engineyuuji.yaginuma2015-06-283-3/+3
|
* assigns was removed from RailsRafael Mendonça França2015-06-111-1/+0
|
* Make Rails API apps return the full resource on updateSantiago Pastorino2015-06-111-1/+1
|
* Fix class_option description for api generatorsSantiago Pastorino2015-06-111-1/+1
|