It is a major version up, in particular:
- Rails 6 almost dropped Sprockets in favour of Webpack
- Rails 7 almost dropped Webpack in favour of jsbundling-rails + import maps (or esbuild) + Sprockets.
The backgrond is
| require 'optparse' | |
| require 'optparse/time' # if Time is used. | |
| #require 'ostruct' | |
| require 'pp' | |
| # This example file for using Ruby optparse is based on the original example | |
| # code in Github, specifically, commit number f2b8318, or roughly for Ruby 3.1.2. | |
| # https://github.com/ruby/optparse | |
| # I have added several sections and modified some parts, as well as annotated | |
| # the code extensively with my comments. |
| gem "minitest" | |
| require 'minitest/autorun' | |
| require 'tempfile' | |
| # In general, each test method should generate its own temporary files. | |
| # With the following code, the temporary files will be automatically deleted | |
| # at the end of the processing, even if their IOs have been alraedy closed | |
| # and only the filename (path) were utilised during processing. | |
| class TestUnitMyLibrary < MiniTest::Test |
| require "tempfile" | |
| # TeeIO to "tee" (or splice) an IO | |
| # | |
| # Basically this overwrites IO#write . | |
| # | |
| # Note this does not capture IO#syswrite | |
| # | |
| # The main part but {TeeIO.suppress_io} is taken from | |
| # {https://stackoverflow.com/a/9439298/3577922} |
:en and :ja and :fr, where :en is the default./ja/articles is for Index of Article model.http://example.com/articles
I18n.locale should be set according to the browser's request, falling back to :en| # -*- coding: utf-8 -*- | |
| require 'w3c_validators' | |
| # Module to deal with W3C Validator | |
| # | |
| # == Usage | |
| # | |
| # Put this file in one of your library-load paths in the test environment. | |
| # Then, in /test/test_helper.rb |
| # Returns the String for the caller information | |
| # | |
| # @example To display the location of the last caller in the *_test.rb file. | |
| # assert abc, sprintf("(%s): abc=%s", _get_caller_info_message, abc.inspect) # defined in test_helper.rb | |
| # | |
| # @example displays the exact line where an error occurs | |
| # assert false, _get_caller_info_message(bind_offset: -1, prefix: true)+" Error occurs exactly at this line." | |
| # | |
| # @param bind_offset: [Integer, NilClass] offset for caller_locations (used for displaying the caller routine). In default (=nil), the last location in *_test.rb (such as, inside a block). If this is 0, it is useful in the case where this method is called in a test library method that is called from an original test routine. Therefore, specify "-1" to get the information of the caller itself (Second example above). | |
| # @param fmt: [String] sprintf format. It must contain %s (for path) and %d (or %s) (for line number) in this order. |
| module ModuleWasFounds | |
| class InconsistencyInWasFoundError < StandardError # ModuleWasFounds::InconsistencyInWasFoundError | |
| ## Error in inconsistency in ModuleWasFound#was_found? and ModuleWasFound#was_created? | |
| end | |
| end |
Manual testing (for heroku-24-stack) with a Ruby-on-Rails app
heroku create --remote heroku-24 --stack heroku-24 <your app name>-heroku-24
<your app name>-heroku-24; let us call it <your-app-24>