aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/test_unit/scaffold
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.
* Fix warning: shadowing outer local variable - attributeRyuta Kamizono2018-12-131-1/+1
|
* Fix boolean interaction in scaffold system testsGannon McGibbon2018-12-122-0/+13
|
* 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.
* 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-133-0/+0
| | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* [Railties] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* Remove frozen_string_literal magic comment from templatesyuuji.yaginuma2017-09-173-6/+0
| | | | Follow up of #30348
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-144-0/+8
|
* [Railties] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Add system tests to generate scaffoldDinah Shi2017-06-304-8/+68
|
* 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.
* applies new string literal convention in railties/libXavier Noria2016-08-061-3/+3
| | | | | 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
|
* 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-152-20/+22
| | | | | | | | | | | | 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-132-15/+14
| | | | | | | | | 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-132-14/+15
| | | | 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-282-2/+2
|
* 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
|
* API apps scaffold generator generates an apropriate controllerSantiago Pastorino2015-06-112-1/+46
|
* Merge pull request #20387 from y-yagi/fix_engine_generated_controller_testYves Senn2015-06-022-1/+13
|\ | | | | | | set engine's route in the functional test is generated in the engine
| * add engine's namespace to fixture nameyuuji.yaginuma2015-05-312-1/+10
| |
| * set engine's route in the functional test is generated in the engineyuuji.yaginuma2015-05-311-0/+3
|/
* Removed `assigns` from functional_test templatesPrathamesh Sonpatki2015-05-021-3/+2
| | | | | - Based on DHH's suggestion about deprecating `assigns` in https://github.com/rails/rails/pull/18305#issuecomment-68605166.
* scaffold controller_test template should use kwargs. refs #18323.Yves Senn2015-01-301-5/+5
| | | | This prevents a flood of warnings when generating a new scaffold.
* Add support for generate scaffold password:digestSam Ruby2013-03-131-1/+5
| | | | | | | | | | * adds password_digest attribute to the migration * adds has_secure_password to the model * adds password and password_confirmation password_fields to _form.html * omits password entirely from index.html and show.html * adds password and password_confirmation to the controller * adds unencrypted password and password_confirmation to the controller test * adds encrypted password_digest to the fixture
* test PATCH method for update action in generated scaffold controller test ↵Akira Matsuda2013-01-031-1/+1
| | | | rather than PUT
* Extract a attributes_names method to avoid duplicationRafael Mendonça França2012-12-101-12/+4
|
* Deal with polymorphic attributes correctly in the generatorsRafael Mendonça França2012-12-101-5/+11
|
* Put the reference and belongs_to attributes in the scaffold tests.Rafael Mendonça França2012-12-101-6/+3
|
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-2/+2
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-10-111-3/+3
|\ | | | | | | | | | | Conflicts: activerecord/lib/active_record/persistence.rb railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
| * nodoc TestUnit::Generators [ci skip]Francesco Rodriguez2012-10-071-3/+3
| |
* | Update test locationsMike Moore2012-10-091-1/+1
|/ | | | | | | | | | | | | | Change the default test locations to avoid confusion around the common testing terms "unit" and "functional". Add new rake tasks for the new locations, while maintaining backwards compatibility with the old rake tasks. New testing locations are as follows: app/models -> test/models (was test/units) app/helpers -> test/helpers (was test/units/helpers) app/controllers -> test/controllers (was test/functional) app/mailers -> test/mailers (was test/functional)
* Remove unused generator options. This was added for the removed rails new --httpSantiago Pastorino2012-04-181-3/+0
|
* Remove --http.José Valim2012-03-142-54/+2
|
* Generate special controller and functional test templates for http appsCarlos Antonio da Silva2012-03-142-1/+56
| | | | | | | | | | | | The main goal is to not generate the format.html block in scaffold controller, and to generate a different functional test as we don't rely on redirects anymore, we should test for http responses. In addition to that, the :edit action is removed from the http controller and the edit route is not generated by default, as they usually do not make sense in this scenario. [Carlos Antonio da Silva & Santiago Pastorino]
* Remove key_value helper now that master is 1.9 only and we always useRafael Mendonça França2012-03-132-10/+6
| | | | the 1.9 hash syntax in the generators.
* Refactor the test_unit scaffold generator to use the key_value methodRafael Mendonça França2012-03-131-1/+1
|
* Use the attributes hash explicitlyRafael Mendonça França2012-03-132-6/+18
|
* Do not use the attributes hash in the scaffold functional testsRafael Mendonça França2012-03-122-2/+11
|
* Remove needless to_param in scaffold functional testAlexey Vakhov2011-10-241-4/+4
|