aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Do not show suggestion message when not exist suggestionyuuji.yaginuma2018-12-291-0/+1
| | | | | | | | | | | | | | | | | | **before** ``` $ ./bin/rails g g Could not find generator 'g'. Maybe you meant nil? Run `rails generate --help` for more options. ``` **after** ``` $ ./bin/rails g g Could not find generator 'g'. Run `rails generate --help` for more options. ```
* Remove unnecessary testyuuji.yaginuma2018-06-031-6/+0
| | | | | Since #32289, `Spellchecker.suggest` returns only one value, multiple suggestions not output.
* Use `did_you_mean` spell checker for option suggestionsGenadi Samokovarov2018-03-231-3/+3
| | | | | | | | | | | Now that we require Ruby over `2.3`, we can replace the current suggestion methods we have with tooling from the `did_you_mean` gem. There is a small user visible change and this is that we now offer a single suggestion for misspelled options. We are suggesting fixes during generator invocation and during a mistyped rails server rack handler. In both cases, if we don't make a proper prediction on the first match, we won't do so in the second or third one, so in my mind, this is okay.
* Use assert_empty and assert_not_emptyDaniel Colson2018-01-251-1/+1
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-1/+1
|
* Fix generator suggestion raise error when I18n.available_locales don’t ↵willnet2017-11-221-0/+13
| | | | include :en
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Stop creating ApplicationRecord on model generationLisa Ugray2017-07-241-1/+1
| | | | | | | | | | | | | | When generating models, we created ApplicationRecord in the default location if no file existed there. That was annoying for people who moved it to somewhere else in the autoload path. At this point, the vast majority of apps should have either run the upgrade script or generated a model since upgrading. For those that haven't the error message after generating a new model should be helpful: NameError: uninitialized constant ApplicationRecord To ease friction in that case, this also adds a generator for ApplicationRecord.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Use `require_relative` instead of `require` with full pathbogdanvlviv2017-06-141-1/+1
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Use appropriate type in generators testyuuji.yaginuma2017-03-081-1/+1
| | | | | | | | This fixes the following thor's warning. ``` Expected string default value for '--generate'; got false (boolean) ```
* improve error message when include assertions failMichael Grosser2016-09-161-3/+3
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add three new rubocop rulesRafael Mendonça França2016-08-161-10/+10
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies new string literal convention in railties/testXavier Noria2016-08-061-9/+9
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Cleaned up generators tests using internal assertion helperRonak Jangir2015-08-201-17/+7
|
* Remove use of mocha in the railties generators tests Ronak Jangir2015-05-221-18/+34
|
* Fix generator testsRafael Mendonça França2015-05-031-1/+1
| | | | In my machine the output is different
* Revert "Fix multiple suggestion test"Arthur Neves2015-04-251-1/+1
| | | | This reverts commit 6a7cf515123889360d272e8ab4be045578dfc0fb.
* Fix multiple suggestion testArthur Neves2015-04-251-1/+1
|
* Add test for multiple suggested generator names.Josef Šimánek2015-04-251-0/+6
|
* Fix Railties tests that were order dependentAkira Matsuda2014-08-131-0/+10
|
* Stop requiring mocha automaticallyRafael Mendonça França2014-07-191-0/+1
| | | | | | | | | | | We are planning to remove mocha from our test suite because of performance problems. To make this possible we should stop require mocha on ActionSupport::TestCase. This should not affect applications since users still need to add mocha to Gemfile and this already load mocha. Added FIXME notes to place that still need mocha removal
* Emit suggested generator names when not foundschneems2014-06-041-1/+7
| | | | | | | | | | | | | | | When someone types in a generator command it currently outputs all generators. Instead we can attempt to find a subtle mis-spelling by running all generator names through a levenshtein_distance algorithm provided by rubygems. So now a failure looks like this: ```ruby $ rails generate migratioooons Could not find generator 'migratioooons'. Maybe you meant 'migration' or 'integration_test' or 'generator' Run `rails generate --help` for more options. ``` If the suggestions are bad we leave the user with the hint to run `rails generate --help` to see all commands.
* print generators on failed generateschneems2014-05-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's say we just ran: ``` $ rails g migrate add_click_to_issue_assignment ``` We will get an error that looks like: ``` Could not find generator migrate. ``` This patch adds all existing migrations to the output to make it easier for a developer to find a valid migration. ``` Could not find generator "migrate". Please select a valid generator: Rails: assets controller generator helper integration_test mailer migration model resource scaffold scaffold_controller task ``` It would be nice to do some spelling detection and suggest alternatives, but for now this should help.
* More Warnings removed for ruby trunkArun Agrawal2013-11-011-2/+2
| | | | Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
* Revert "Isolate railties Generators Tests"Guillermo Iguaran2013-08-021-1/+0
| | | | | This fixes railties tests in JRuby but break it in MRI This reverts commit fea99276c7024f183bf72a16ad9f36af4bae1d42.
* Isolate railties Generators TestsAlex Tambellini2013-08-021-0/+1
| | | | With this change jruby should pass all of the railties tests.
* s/plugin_new/pluginschneems2013-06-301-1/+1
| | | | | There are historical reasons that the `plugin` command was `plugin_new`, now those are no longer applicable, we should remove the naming edge case from the project. This PR is based off of comments from #11176 ATP Railties
* cleanup railties test; fix typosVipul A M2013-03-311-1/+1
|
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-4/+4
|
* Fix class_eval without __FILE__ and __LINE__.kennyj2012-07-181-1/+1
|
* remove duplicate requires of mocha.Aaron Patterson2012-07-031-1/+0
| | | | | Mocha is already required by AS::TestCase, so remove the duplicate requires.
* Unused variable warning removed.Arun Agrawal2012-05-301-1/+1
|
* More assert_match warnings fixed.Arun Agrawal2012-05-301-1/+1
|
* Remove --http.José Valim2012-03-141-51/+0
|
* Generate special controller and functional test templates for http appsCarlos Antonio da Silva2012-03-141-1/+10
| | | | | | | | | | | | 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]
* Disable template, helper and assets options when using http_only!Carlos Antonio da Silva2012-03-141-0/+18
| | | | [Carlos Antonio da Silva & Santiago Pastorino]
* Create generators http_only! setup and hide some common namespaces for nowCarlos Antonio da Silva2012-03-141-0/+24
| | | | [Carlos Antonio da Silva & Santiago Pastorino]
* Add convenience method to hide a generator from the available onesCarlos Antonio da Silva2012-02-031-1/+7
| | | | | | It is usually useful to be able to hide a generator when running rails generate command. Such generators might be used only to dry up generators code and shouldn't be available to end users.
* treat USAGE as an ERB templateColin MacKenzie IV2011-11-021-0/+6
|
* Removed tests for rescue branch for Rails 2.x compatibilityAlexey Gaziev2011-06-201-6/+0
|
* load_generators_from_railties was removed, remove failing ↵Guillermo Iguaran2011-05-241-7/+0
| | | | test_load_generators_from_railties
* be sure to parenthesize the arguments when the first one is a RegExp literalAkira Matsuda2011-05-181-15/+15
| | | | | | this fixes: "warning: ambiguous first argument; put parentheses or even spaces" because: you need this to tell the parser that you're not calling :/ method (division) details (Japanese!): http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-dev/42445?42370-43277
* Allow generators nested in more than one levelSantiago Pastorino2011-01-121-0/+8
|
* Make sure that generator's default banner is showing its namespacePrem Sichanugrist2011-01-011-0/+10
| | | | This will make `rails g rspec:install --help` shows "rails generate rspec:install [options]" and not "rails generate install [options]"
* Tidy up generators commits.José Valim2010-11-171-0/+6
|
* application generation: --skip-testunit and --skip-activerecord renamed to ↵Xavier Noria2010-07-251-1/+1
| | | | | | | | --skip-test-unit and --skip-active-record respectively Reason is their proper spellings are "Test::Unit" and "Active Record". Option names and descriptions have been revised, as well as some method names and minor details here and there.
* Update generators test.José Valim2010-05-151-12/+1
|