aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #32381 from q-centrix/update-codeclimate-configsRichard Schneeman2018-07-252-10/+7
|\ | | | | Turn on performance based cops
| * Turn on performance based copsDillon Welch2018-07-232-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* | Merge pull request #33229 from ↵Matthew Draper2018-07-256-12/+12
|\ \ | |/ |/| | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * Show rails instead of bin/rails on USAGE instructionsAlberto Almagro2018-07-064-9/+9
| | | | | | | | | | With this commit, rails commands usage instructions display now +rails+ instead of +bin/rails+ within their recommendations.
| * Recommend use of rails over bin/railsAlberto Almagro2018-07-063-3/+3
| | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | Clarify `railties/test/application/rake/notes_test.rb`bogdanvlviv2018-07-211-59/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | After 1996fbe2a3e46ff5698bfa3812afb7f42cdfa899 `rails notes` isn't the same as `rake notes`. Since that, we should test `rake routes` instead of `rails notes` in `railties/test/application/rake/notes_test.rb` file. So I changed all occurrences of `rails routes` to `rake routes` in that file, and added assertions about deprecation warning of using `rake notes`. It will help to figure out that we should remove `railties/test/application/rake/notes_test.rb` entirely in favour of `railties/test/commands/notes_test.rb` that was added in 1996fbe2a3e46ff5698bfa3812afb7f42cdfa899.
* | Fix deprecation message for `SOURCE_ANNOTATION_DIRECTORIES`yuuji.yaginuma2018-07-201-0/+3
| | | | | | | | Also, added a test that a deprecated message will be output.
* | Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-121-1/+0
| | | | | | | | | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* | Allow to explicitly specify whether to output Rails' log to stdoutMarkus Doits2018-07-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before Rails' logger output is mirrored to std out if: * environment is development and * the process is not daemonized It was not possible to change that behaviour, e.g. to disable log output in that case or enable it in other cases. Now you can explicitly disable or enable output with the new command line switch `--log-to-stdout`, regardless of any other circumstances. ``` // enable output in production rails server -e production --log-to-stdout // disable output in development rails server -e development --no-log-to-stdout ``` Enabling output when daemonized still makes no sense (since tty is detached), but this is ignored for now. If the command line flag is not specified, old behaviour still applies, so this change is completely backward compatible.
* | Don't show unneeded deprecation warning on server restart.Kasper Timm Hansen2018-07-071-3/+2
|/ | | | | | | | | | | | | | | | | If booting a server via `rails s -u puma`, we'd convert the option to a `using` positional. When using `rails restart` our `restart_command` would the option converted to the using positional and put that in the restart command. Thus we'd show users deprecation warnings for our own code. Fix that by converting a passed positional to an option instead. Also: fix initialize method signature. The local_options are an array, not a hash. But don't even bother assigning defaults as Thor passes them in.
* Make NotesCommand tests more performant by getting rid of unecessary mapAnnie-Claude Côté2018-07-051-12/+12
| | | | | | | * Get rid of map and replace it with a multiplication of "\n" to generate document with multiple line preceding the annotation * Reduce number from 1000 to 100 since it achieves the same goal * Only keep one test for the multiple lines document since it's unecessary to test multiple times * Update some language in tests names to make it clearer what we are testing
* Merge pull request #33220 from anniecodes/notes-commandKasper Timm Hansen2018-07-051-0/+128
|\ | | | | Adds `Rails::Command::NotesCommand` and makes `rake notes` use it under the hood
| * Adds support to register directories and extensions to NotesCommandAnnie-Claude Côté2018-07-041-0/+44
| | | | | | | | | | * Require the application and environnement in the notes command in order to load the config files * Adds tests for both register_directories and register_extensions added to a config file
| * Adds a Rails::Command for NotesAnnie-Claude Côté2018-07-041-0/+84
| | | | | | | | | | | | | | | | * It is called with `rails notes` * It defaults to displaying [OPTIMIZE, FIXME and TODO] annotations * It accepts custom annotations by using `rails notes -a CUSTOM_ANNOTATION OTHER_ANNOTATION` * It defaults to look for annotations in [app config db lib test] as dictated by SourceAnnotationExtractor * It supports ENV["SOURCE_ANNOTATION_DIRECTORIES"] but adds a deprecation warning and recommends using register_directories instead
* | Merge pull request #32706 from ↵Kasper Timm Hansen2018-07-011-0/+24
|\ \ | | | | | | | | | | | | yhirano55/fix-app-update-when-hyphenated-name-is-given Fix app:update when hyphenated name is given
| * | Fix app:update when hyphenated name is givenYoshiyuki Hirano2018-04-241-0/+24
| | | | | | | | | | | | | | | | | | * Fixed app_name's difference between `rails new` and `app:update` * Changed be prefer to const name than directory name. * Kept original app name which use exception message.
* | | Add an assertion that `credentials:edit` works when `RAILS_MASTER_KEY` env ↵yuuji.yaginuma2018-06-241-1/+1
| | | | | | | | | | | | is specified
* | | OS X -> macOS [Closes #30313]Xavier Noria2018-06-231-1/+1
| | | | | | | | | | | | [Jon Moss & Xavier Noria]
* | | Fix Ruby version in `.ruby-version`bogdanvlviv2018-06-181-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #30016 Rails generates `.ruby-version` file in order to help Ruby version manager tools like `rbenv`, `rvm` determine which Ruby version should be used for the current Rails project. Since #32649 Rails sets Ruby version to the file compatible with MRI/JRuby by default. Pull Request #31496 reports that `.ruby-version` doesn't match ruby version other than stable version and recommends to use `ENV["RBENV_VERSION"]`, and `ENV["rvm_ruby_string"]` in order to set correct Ruby version to the file that `rbenv` or `rvm` can understand. Also, there is another similar issue that reports the same case if use JRuby https://github.com/jruby/jruby/issues/5144. Closes #31496, https://github.com/jruby/jruby/issues/5144.
* | | Include `ActiveSupport::Testing::MethodCallAssertions` in ↵bogdanvlviv2018-06-092-2/+2
| | | | | | | | | | | | | | | | | | `railties/test/isolation/abstract_unit.rb` Related to #33102
* | | Remove unnecessary testyuuji.yaginuma2018-06-031-6/+0
| |/ |/| | | | | | | Since #32289, `Spellchecker.suggest` returns only one value, multiple suggestions not output.
* | Enable `Lint/StringConversionInInterpolation` rubocop ruleRyuta Kamizono2018-05-211-1/+1
| | | | | | | | | | To prevent redundant `to_s` like https://github.com/rails/rails/pull/32923#discussion_r189460008 automatically in the future.
* | Add test case that configure ↵yuuji.yaginuma2018-05-201-0/+17
| | | | | | | | | | | | `config.action_view.finalize_compiled_template_methods` Follow up of #32418.
* | Don't generate yarn's contents in `app:update` task if it's skippedTsukuru Tanimichi2018-05-161-0/+21
| |
* | Merge pull request #32837 from ttanimichi/app-update-skip-springYuji Yaginuma2018-05-141-0/+11
|\ \ | | | | | | Don't generate `config/spring.rb` in `app:update` task when spring isn't loaded
| * | Don't generate `config/spring.rb` in `app:update` task when spring isn't loadedTsukuru Tanimichi2018-05-131-0/+11
| | |
* | | Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-133-3/+3
|/ / | | | | | | Follow up of #32605.
* | Skip `bootsnap` contents in `app:update` task if `bootsnap` is not usedyuuji.yaginuma2018-05-071-0/+13
| |
* | prefer File.write for bulk writesXavier Noria2018-05-052-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I saw these ones while working on #32362. File.write was introduced in Ruby 1.9.3 and it is the most concise way to perform bulk writes (as File.read is for bulk reading). The existing flags enabled binmode, but we are dumping text here. The portable way to dump text is text mode. The only difference is newlines, and portable code should in particular emit portable newlines. Please note the hard-coded \ns are still correct. In languages with C semantics for newlines like Ruby, Python, Perl, and others, "\n" is a portable newline. Both when writing and when reading. On Windows, the I/O layer is responsible for prepending a CR before each LF on writing, and removing CRs followed by LFs on reading. On Unix, binmode is a no-op.
* | Don't generate assets' initializer in `app:update` task if sprockets is skippedTsukuru Tanimichi2018-05-051-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Execute `rails new myapp -S` and then upgrade the app by using the `app:update` task, `bin/rails c` results in `NoMethodError`. ``` $ bin/rails app:update $ bin/rails c Traceback (most recent call last): 44: from bin/rails:4:in `<main>' (snip) 1: from /Users/tanimichi.tsukuru/ghq/github.com/moneyforward/moneyplus/config/initializers/assets.rb:4:in `<top (required)>' /Users/tanimichi.tsukuru/ghq/github.com/moneyforward/moneyplus/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0x00007fcb8d3697e0> (NoMethodError) Did you mean? asset_host ```
* | Swap assertion order for better reportingutilum2018-04-291-1/+1
| | | | | | | | `assert_directory("test/system")` may pass even if `assert_file("test/system/.keep")` fails.
* | Add a helper method to check that gem does not exist in `Gemfile`yuuji.yaginuma2018-04-251-49/+26
| |
* | Fix test method nameyuuji.yaginuma2018-04-251-2/+2
| | | | | | | | We don't use `mini_magick` directly since #32471.
* | Merge pull request #32471 from janko-m/use-image_processing-gemGeorge Claghorn2018-04-231-2/+2
|\ \ | |/ |/| Use ImageProcessing gem for ActiveStorage variants
| * Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
* | Merge pull request #32686 from yhirano55/fix-indentation-with-rubocopRyuta Kamizono2018-04-221-1/+1
|\ \ | | | | | | Fix indentation manually
| * | Fix indentation manuallyYoshiyuki Hirano2018-04-221-1/+1
| | | | | | | | | | | | Rubocop auto-correct doesn't work well, so I fixed indentation manually.
* | | Merge pull request #31554 from fatkodima/controller_generator_suffixGuillermo Iguaran2018-04-221-0/+22
|\ \ \ | | | | | | | | Gracefully handle extra "controller" when generating controller
| * | | Gracefully handle extra "controller" when generating controllerfatkodima2018-03-231-0/+22
| | | |
* | | | Merge pull request #32685 from yhirano55/fix-duplicated-suffix-for-job-generatorRyuta Kamizono2018-04-221-0/+10
|\ \ \ \ | | | | | | | | | | Fix duplicated suffix for JobGenerator
| * | | | Fix duplicated suffix for JobGeneratorYoshiyuki Hirano2018-04-221-0/+10
| | |/ / | |/| |
* / | | Add test case to ChannelGeneratorTestYoshiyuki Hirano2018-04-221-0/+10
|/ / / | | | | | | | | | * Add a test case to ensure avoid duplicated suffix in channel generator
* | | Don't include bootsnap by default in apps generated under JRubyGuillermo Iguaran2018-04-201-3/+12
| | |
* | | Fix typo on method nameAlberto Almagro2018-04-201-1/+1
| | |
* | | Create a .ruby-version compatible with MRI/JRuby by defaultGuillermo Iguaran2018-04-191-1/+1
| | |
* | | Merge pull request #32605 from composerinteralia/assert-notRafael França2018-04-1913-37/+37
|\ \ \ | | | | | | | | Add RuboCop for `assert_not` over `assert !`
| * | | Replace `assert !` with `assert_not`Daniel Colson2018-04-1913-37/+37
| | | | | | | | | | | | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | | | Make the master.key readable only by the ownerJose Luis Duran2018-04-191-0/+9
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change may only apply to POSIX-compliant systems. Previously: $ ls -l config/master.key -rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key Now: $ ls -l config/master.key -rw------- 1 owner group 32 Jan 1 00:00 master.key
* | | Fix test to allow IF NOT EXISTS in structure:dumputilum2018-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` $ ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] $ ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/rake/multi_dbs_test.rb Run options: --seed 28744 F Failure: ApplicationTests::RakeTests::RakeMultiDbsTest#test_db:migrate_and_db:structure:dump_and_db:structure:load_works_on_all_databases [test/application/rake/multi_dbs_test.rb:70]: Expected /CREATE TABLE \"books\"/ to match "CREATE TABLE IF NOT EXISTS \"schema_migrations\" (\"version\" varchar NOT NULL PRIMARY KEY);\nCREATE TABLE IF NOT EXISTS \"ar_internal_metadata\" (\"key\" varchar NOT NULL PRIMARY KEY, \"value\" varchar, \"created_at\" datetime NOT NULL, \"updated_at\" datetime NOT NULL);\nCREATE TABLE IF NOT EXISTS \"books\" (\"id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL, \"title\" varchar, \"created_at\" datetime NOT NULL, \"updated_at\" datetime NOT NULL);\nCREATE TABLE sqlite_sequence(name,seq);\nINSERT INTO \"schema_migrations\" (version) VALUES\n('20180416201805');\n\n\n". ```
* | | Deprecate support for using `HOST` environment to specify server IP (#32540)Yuji Yaginuma2018-04-161-1/+15
| |/ |/| | | | | | | | | | | | | | | | | | | | | At SuSE, `$HOST` is set by default and is equal to `$HOSTNAME`. https://www.suse.com/documentation/sled11/book_sle_admin/data/sec_adm_variables.html Therefore, by default, it binds to hostname instead of `localhost`. This seems not to be appropriate as default behavior. In order to avoid the name of the environment variable being used, I changed the environment variable from `HOST` to `BINDING`. Fixes #29516.