diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 590e8101..cefe34dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,9 @@ jobs: - '2.7' - '3.0' - '3.1' + - '3.2' gemfile: - - gemfiles/rails-7.0.0.gemfile + - gemfiles/rails-7.1.0.gemfile env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} diff --git a/.rubocop.yml b/.rubocop.yml index 0f0d9ea5..a902dbee 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,11 @@ AllCops: TargetRubyVersion: 2.7 + SuggestExtensions: false NewCops: enable +Gemspec/DevelopmentDependencies: + Enabled: false + Layout/LineLength: Max: 100 Exclude: diff --git a/Gemfile b/Gemfile index 121540ba..dff08e53 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,6 @@ source "http://rubygems.org" gemspec gem "irb" -gem "rails", "~> 7.0.0" +gem "rails", "~> 7.1.0" gem "rake" gem "sqlite3" diff --git a/README.md b/README.md index 649edc8a..66549240 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # minitest-rails -Minitest integration for Rails 7.0 +Minitest integration for Rails 7.1 [![CI](https://github.com/blowmage/minitest-rails/actions/workflows/ci.yml/badge.svg)](https://github.com/blowmage/minitest-rails/actions/workflows/ci.yml) [![Code Climate](https://codeclimate.com/github/blowmage/minitest-rails.png)](https://codeclimate.com/github/blowmage/minitest-rails) @@ -22,9 +22,16 @@ Create a new rails app: ### Choosing a version This gem follows the versioning of Rails. -If you are running Rails 7.0, specify the corresponding 7.0 release in the Gemfile. +If you are running Rails 7.1, specify the corresponding 7.1 release in the Gemfile. For example: +```ruby +gem "minitest-rails", "~> 7.1.0" +``` + +If you are running Rails 7.0, specify the corresponding 7.0 release in the Gemfile. +For example, if you are using Rails 6.1 you will specify: + ```ruby gem "minitest-rails", "~> 7.0.0" ``` diff --git a/gemfiles/rails-7.0.0.gemfile b/gemfiles/rails-7.1.0.gemfile similarity index 59% rename from gemfiles/rails-7.0.0.gemfile rename to gemfiles/rails-7.1.0.gemfile index 6790caae..f2c95e79 100644 --- a/gemfiles/rails-7.0.0.gemfile +++ b/gemfiles/rails-7.1.0.gemfile @@ -1,12 +1,12 @@ source "http://rubygems.org" gem "minitest-rails", path: "../" -gem "rails", "~> 7.0.0" +gem "rails", "~> 7.1.0" gem "rake" gem "sqlite3" gem "minitest-autotest", "~> 1.1" -gem "minitest-focus", "~> 1.3" +gem "minitest-focus", "~> 1.4" gem "minitest-rg", "~> 5.2" -gem "rdoc", "~> 6.4" -gem "rubocop", "~> 1.28.0" +gem "rdoc", "~> 6.5" +gem "rubocop", "~> 1.57.0" diff --git a/lib/generators/minitest/controller/controller_generator.rb b/lib/generators/minitest/controller/controller_generator.rb index b3c09102..c0abb5df 100644 --- a/lib/generators/minitest/controller/controller_generator.rb +++ b/lib/generators/minitest/controller/controller_generator.rb @@ -6,6 +6,8 @@ module Minitest # :nodoc: module Generators # :nodoc: class ControllerGenerator < Base # :nodoc: argument :actions, type: :array, default: [], banner: "action action" + class_option :skip_routes, type: :boolean + check_class_collision suffix: "ControllerTest" def create_test_files diff --git a/lib/generators/minitest/controller/templates/functional_spec.rb.tt b/lib/generators/minitest/controller/templates/functional_spec.rb.tt index e645352e..11c5109e 100644 --- a/lib/generators/minitest/controller/templates/functional_spec.rb.tt +++ b/lib/generators/minitest/controller/templates/functional_spec.rb.tt @@ -12,11 +12,11 @@ describe <%= class_name %>Controller do # end <% else -%> <% actions.each do |action| -%> - it "must get <%= action %>" do + it "gets <%= action %>" do get <%= url_helper_prefix %>_<%= action %>_url must_respond_with :success end - +<%= "\n" unless action == actions.last -%> <% end -%> <% end -%> end diff --git a/lib/generators/minitest/controller/templates/functional_test.rb.tt b/lib/generators/minitest/controller/templates/functional_test.rb.tt index 0783a646..5c16ce4c 100644 --- a/lib/generators/minitest/controller/templates/functional_test.rb.tt +++ b/lib/generators/minitest/controller/templates/functional_test.rb.tt @@ -16,7 +16,7 @@ class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest get <%= url_helper_prefix %>_<%= action %>_url assert_response :success end - +<%= "\n" unless action == actions.last -%> <% end -%> <% end -%> end diff --git a/lib/generators/minitest/generator/generator_generator.rb b/lib/generators/minitest/generator/generator_generator.rb index dc5acb15..334b50da 100644 --- a/lib/generators/minitest/generator/generator_generator.rb +++ b/lib/generators/minitest/generator/generator_generator.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + require "generators/minitest" -module Minitest - module Generators +module Minitest # :nodoc: + module Generators # :nodoc: class GeneratorGenerator < Base # :nodoc: check_class_collision suffix: "GeneratorTest" diff --git a/lib/generators/minitest/generator/templates/generator_spec.rb.tt b/lib/generators/minitest/generator/templates/generator_spec.rb.tt index 67be13b6..af854031 100644 --- a/lib/generators/minitest/generator/templates/generator_spec.rb.tt +++ b/lib/generators/minitest/generator/templates/generator_spec.rb.tt @@ -2,8 +2,8 @@ require "test_helper" require "<%= generator_path %>" <% module_namespacing do -%> -describe <%= class_name %>Generator do - #tests <%= class_name %>Generator +describe <%= class_name %>Generator, :generator do + tests <%= class_name %>Generator destination Rails.root.join("tmp/generators") setup :prepare_destination diff --git a/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt b/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt index a3c5b002..f838f693 100644 --- a/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt +++ b/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt @@ -11,13 +11,15 @@ describe "ApplicationCable Connection", :connection do # end end <%- else -%> -class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase - # def test_connects_with_cookies - # cookies.signed[:user_id] = 42 - # - # connect - # - # assert_equal connection.user_id, "42" - # end +module ApplicationCable + class ConnectionTest < ActionCable::Connection::TestCase + # test "connects with cookies" do + # cookies.signed[:user_id] = 42 + # + # connect + # + # assert_equal connection.user_id, "42" + # end + end end <%- end -%> diff --git a/lib/generators/minitest/install/templates/test/test_helper.rb.tt b/lib/generators/minitest/install/templates/test/test_helper.rb.tt index 4be58c46..995c40f0 100644 --- a/lib/generators/minitest/install/templates/test/test_helper.rb.tt +++ b/lib/generators/minitest/install/templates/test/test_helper.rb.tt @@ -5,18 +5,20 @@ require_relative "../config/environment" require "rails/test_help" require "minitest/rails" -class ActiveSupport::TestCase - # Run tests in parallel with specified workers -<% if defined?(JRUBY_VERSION) || Gem.win_platform? -%> - parallelize(workers: :number_of_processors, with: :threads) +module ActiveSupport + class TestCase + # Run tests in parallel with specified workers +<% if Process.respond_to?(:fork) && !Gem.win_platform? -%> + parallelize(workers: :number_of_processors) <%- else -%> - parallelize(workers: :number_of_processors) + parallelize(workers: :number_of_processors, with: :threads) <% end -%> <% unless options[:skip_active_record] -%> - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all <% end -%> - # Add more helper methods to be used by all tests here... + # Add more helper methods to be used by all tests here... + end end diff --git a/lib/generators/minitest/integration/templates/integration_spec.rb.tt b/lib/generators/minitest/integration/templates/integration_spec.rb.tt index a7ee721e..053b41da 100644 --- a/lib/generators/minitest/integration/templates/integration_spec.rb.tt +++ b/lib/generators/minitest/integration/templates/integration_spec.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> describe "<%= human_name %>", :integration do diff --git a/lib/generators/minitest/integration/templates/integration_test.rb.tt b/lib/generators/minitest/integration/templates/integration_test.rb.tt index b3b1d82f..46c17b55 100644 --- a/lib/generators/minitest/integration/templates/integration_test.rb.tt +++ b/lib/generators/minitest/integration/templates/integration_test.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> class <%= class_name %>Test < ActionDispatch::IntegrationTest diff --git a/lib/generators/minitest/job/templates/unit_spec.rb.tt b/lib/generators/minitest/job/templates/unit_spec.rb.tt index 5ef273bd..ea037d10 100644 --- a/lib/generators/minitest/job/templates/unit_spec.rb.tt +++ b/lib/generators/minitest/job/templates/unit_spec.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> describe <%= class_name %>Job do diff --git a/lib/generators/minitest/job/templates/unit_test.rb.tt b/lib/generators/minitest/job/templates/unit_test.rb.tt index a5f21de2..43e8ef3b 100644 --- a/lib/generators/minitest/job/templates/unit_test.rb.tt +++ b/lib/generators/minitest/job/templates/unit_test.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> class <%= class_name %>JobTest < ActiveJob::TestCase diff --git a/lib/generators/minitest/mailer/templates/functional_test.rb.tt b/lib/generators/minitest/mailer/templates/functional_test.rb.tt index 1cc5e474..f7ee0c17 100644 --- a/lib/generators/minitest/mailer/templates/functional_test.rb.tt +++ b/lib/generators/minitest/mailer/templates/functional_test.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> class <%= class_name %>MailerTest < ActionMailer::TestCase diff --git a/lib/generators/minitest/model/templates/unit_test.rb.tt b/lib/generators/minitest/model/templates/unit_test.rb.tt index 8b9684eb..3657d572 100644 --- a/lib/generators/minitest/model/templates/unit_test.rb.tt +++ b/lib/generators/minitest/model/templates/unit_test.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <% module_namespacing do -%> class <%= class_name %>Test < ActiveSupport::TestCase diff --git a/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt b/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt index b0cbbeb3..7a692df8 100644 --- a/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +++ b/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt @@ -1,4 +1,4 @@ -require 'test_helper' +require "test_helper" <%- if options[:spec] -%> describe <%= class_name %> do diff --git a/lib/generators/minitest/scaffold/scaffold_generator.rb b/lib/generators/minitest/scaffold/scaffold_generator.rb index 41ec99be..5c84bb12 100644 --- a/lib/generators/minitest/scaffold/scaffold_generator.rb +++ b/lib/generators/minitest/scaffold/scaffold_generator.rb @@ -11,7 +11,7 @@ class ScaffoldGenerator < Base # :nodoc: check_class_collision suffix: "ControllerTest" class_option :api, type: :boolean, - desc: "Generates API functional tests" + desc: "Generate API functional tests" class_option :system_tests, type: :string, desc: "Skip system test files" @@ -46,10 +46,10 @@ def attributes_string def attributes_hash return {} if attributes_names.empty? - attributes_names.map do |name| + attributes_names.filter_map do |name| if %w[password password_confirmation].include?(name) && attributes.any?(&:password_digest?) - [name.to_s, "'secret'"] - else + [name.to_s, '"secret"'] + elsif !virtual?(name) [name.to_s, "@#{singular_table_name}.#{name}"] end end.sort.to_h @@ -59,6 +59,11 @@ def boolean? name attribute = attributes.find { |attr| attr.name == name } attribute&.type == :boolean end + + def virtual? name + attribute = attributes.find { |attr| attr.name == name } + attribute&.virtual? + end end end end diff --git a/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt b/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt index 58c0aa59..8ad75e54 100644 --- a/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt +++ b/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt @@ -18,7 +18,7 @@ describe <%= controller_class_name %>Controller do post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json end.must_differ "<%= class_name %>.count" - must_respond_with 201 + must_respond_with :created end it "should show <%= singular_table_name %>" do @@ -28,7 +28,7 @@ describe <%= controller_class_name %>Controller do it "should update <%= singular_table_name %>" do patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json - must_respond_with 200 + must_respond_with :success end it "should destroy <%= singular_table_name %>" do @@ -36,7 +36,7 @@ describe <%= controller_class_name %>Controller do delete <%= show_helper %>, as: :json end.must_differ "<%= class_name %>.count", -1 - must_respond_with 204 + must_respond_with :no_content end end <% end -%> diff --git a/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt b/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt index 46b5282d..372ba55a 100644 --- a/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt +++ b/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt @@ -20,7 +20,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json end - assert_response 201 + assert_response :created end def test_show_<%= singular_table_name %> @@ -30,7 +30,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe def test_update_<%= singular_table_name %> patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json - assert_response 200 + assert_response :success end def test_destroy_<%= singular_table_name %> @@ -38,7 +38,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe delete <%= show_helper %>, as: :json end - assert_response 204 + assert_response :no_content end end <% end -%> diff --git a/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt b/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt index f4383c7e..e9b8f30a 100644 --- a/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt +++ b/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt @@ -9,7 +9,7 @@ describe <%= controller_class_name %>Controller do let(:<%= singular_table_name %>) { <%= fixture_name %>(:one) } it "should get index" do - get <%= index_helper %>_url + get <%= index_helper(type: :url) %> must_respond_with :success end @@ -20,10 +20,10 @@ describe <%= controller_class_name %>Controller do it "should create <%= singular_table_name %>" do assert_difference("<%= class_name %>.count") do - post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } + post <%= index_helper(type: :url) %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } end - must_redirect_to <%= singular_table_name %>_url(<%= class_name %>.last) + must_redirect_to <%= show_helper("#{class_name}.last") %> end it "should show <%= singular_table_name %>" do @@ -38,7 +38,7 @@ describe <%= controller_class_name %>Controller do it "should update <%= singular_table_name %>" do patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } - must_redirect_to <%= singular_table_name %>_url(<%= "#{singular_table_name}" %>) + must_redirect_to <%= show_helper %> end it "should destroy <%= singular_table_name %>" do @@ -46,7 +46,7 @@ describe <%= controller_class_name %>Controller do delete <%= show_helper %> end - must_redirect_to <%= index_helper %>_url + must_redirect_to <%= index_helper(type: :url) %> end end <% end -%> diff --git a/lib/generators/minitest/scaffold/templates/functional_test.rb.tt b/lib/generators/minitest/scaffold/templates/functional_test.rb.tt index 2390c8e5..f694bd18 100644 --- a/lib/generators/minitest/scaffold/templates/functional_test.rb.tt +++ b/lib/generators/minitest/scaffold/templates/functional_test.rb.tt @@ -11,7 +11,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end def test_get_index - get <%= index_helper %>_url + get <%= index_helper(type: :url) %> assert_response :success end @@ -22,10 +22,10 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe def test_create_<%= singular_table_name %> assert_difference("<%= class_name %>.count") do - post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } + post <%= index_helper(type: :url) %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } end - assert_redirected_to <%= singular_table_name %>_url(<%= class_name %>.last) + assert_redirected_to <%= show_helper("#{class_name}.last") %> end def test_show_<%= singular_table_name %> @@ -40,7 +40,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe def test_update_<%= singular_table_name %> patch <%= show_helper %>, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } - assert_redirected_to <%= singular_table_name %>_url(<%= "@#{singular_table_name}" %>) + assert_redirected_to <%= show_helper %> end def test_destroy_<%= singular_table_name %> @@ -48,7 +48,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe delete <%= show_helper %> end - assert_redirected_to <%= index_helper %>_url + assert_redirected_to <%= index_helper(type: :url) %> end end <% end -%> diff --git a/lib/generators/minitest/scaffold/templates/system_spec.rb.tt b/lib/generators/minitest/scaffold/templates/system_spec.rb.tt index 0f98e434..b975fe3a 100644 --- a/lib/generators/minitest/scaffold/templates/system_spec.rb.tt +++ b/lib/generators/minitest/scaffold/templates/system_spec.rb.tt @@ -4,14 +4,14 @@ require "application_system_test_case" describe "<%= class_name.pluralize %>", :system do let(:<%= singular_table_name %>) { <%= fixture_name %>(:one) } - it "visiting the index" do + it "visits the index" do visit <%= plural_table_name %>_url - assert_selector "h1", text: "<%= class_name.pluralize.titleize %>" + assert_selector "h1", text: "<%= human_name.pluralize %>" end - it "creating a <%= human_name %>" do + it "creates a <%= human_name %>" do visit <%= plural_table_name %>_url - click_on "New <%= class_name.titleize %>" + click_on "New <%= human_name.downcase %>" <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> @@ -26,9 +26,9 @@ describe "<%= class_name.pluralize %>", :system do click_on "Back" end - it "updating a <%= human_name %>" do - visit <%= plural_table_name %>_url - click_on "Edit", match: :first + it "updates a <%= human_name %>" do + visit <%= singular_table_name %>_url(@<%= singular_table_name %>) + click_on "Edit this <%= human_name.downcase %>", match: :first <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> @@ -43,11 +43,9 @@ describe "<%= class_name.pluralize %>", :system do click_on "Back" end - it "destroying a <%= human_name %>" do - visit <%= plural_table_name %>_url - page.accept_confirm do - click_on "Destroy", match: :first - end + it "destroys a <%= human_name %>" do + visit <%= singular_table_name %>_url(@<%= singular_table_name %>) + click_on "Destroy this <%= human_name.downcase %>", match: :first assert_text "<%= human_name %> was successfully destroyed" end diff --git a/lib/generators/minitest/scaffold/templates/system_test.rb.tt b/lib/generators/minitest/scaffold/templates/system_test.rb.tt index 7b9388d6..d99fbfff 100644 --- a/lib/generators/minitest/scaffold/templates/system_test.rb.tt +++ b/lib/generators/minitest/scaffold/templates/system_test.rb.tt @@ -8,12 +8,12 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase def test_visiting_index visit <%= plural_table_name %>_url - assert_selector "h1", text: "<%= class_name.pluralize.titleize %>" + assert_selector "h1", text: "<%= human_name.pluralize %>" end def test_creating_<%= human_name %> visit <%= plural_table_name %>_url - click_on "New <%= class_name.titleize %>" + click_on "New <%= human_name.downcase %>" <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> @@ -29,8 +29,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase end def test_updating_<%= human_name %> - visit <%= plural_table_name %>_url - click_on "Edit", match: :first + visit <%= singular_table_name %>_url(@<%= singular_table_name %>) + click_on "Edit this <%= human_name.downcase %>", match: :first <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> @@ -46,10 +46,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase end def test_destroying_<%= human_name %> - visit <%= plural_table_name %>_url - page.accept_confirm do - click_on "Destroy", match: :first - end + visit <%= singular_table_name %>_url(@<%= singular_table_name %>) + click_on "Destroy this <%= human_name.downcase %>", match: :first assert_text "<%= human_name %> was successfully destroyed" end diff --git a/lib/generators/minitest/system/templates/system_spec.rb.tt b/lib/generators/minitest/system/templates/system_spec.rb.tt index b5ce2ba5..873f474c 100644 --- a/lib/generators/minitest/system/templates/system_spec.rb.tt +++ b/lib/generators/minitest/system/templates/system_spec.rb.tt @@ -1,9 +1,8 @@ require "application_system_test_case" -class <%= class_name.pluralize %>Test < ApplicationSystemTestCase - # test "visiting the index" do +describe <%= class_name.pluralize %>, :system do + # it "visits the index" do # visit <%= plural_table_name %>_url - # - # assert_selector "h1", text: "<%= class_name %>" + # assert_selector "h1", text: "<%= human_name.pluralize %>" # end end diff --git a/lib/generators/minitest/system/templates/system_test.rb.tt b/lib/generators/minitest/system/templates/system_test.rb.tt index b5ce2ba5..dd469a67 100644 --- a/lib/generators/minitest/system/templates/system_test.rb.tt +++ b/lib/generators/minitest/system/templates/system_test.rb.tt @@ -1,9 +1,8 @@ require "application_system_test_case" class <%= class_name.pluralize %>Test < ApplicationSystemTestCase - # test "visiting the index" do + # def test_visiting_index # visit <%= plural_table_name %>_url - # - # assert_selector "h1", text: "<%= class_name %>" + # assert_selector "h1", text: "<%= human_name.pluralize %>" # end end diff --git a/lib/minitest/rails.rb b/lib/minitest/rails.rb index ae025df3..8bf418b3 100644 --- a/lib/minitest/rails.rb +++ b/lib/minitest/rails.rb @@ -92,17 +92,19 @@ class ActionDispatch::IntegrationTest end end -# TODO: Rails::Generators::TestCase require? +if defined? Rails::Generators + require "rails/generators/test_unit" -class Rails::Generators::TestCase - # Use R::G::TC for the base class when describing a generator - register_spec_type(self) do |desc| - desc < Rails::Generators::Base if desc.is_a?(Class) - end + class Rails::Generators::TestCase + # Use R::G::TC for the base class when describing a generator + register_spec_type(self) do |desc| + desc < Rails::Generators::Base if desc.is_a?(Class) + end - # Use R::G::TC for the base class when described using :generator - register_spec_type(self) do |_desc, *addl| - addl.include? :generator + # Use R::G::TC for the base class when described using :generator + register_spec_type(self) do |_desc, *addl| + addl.include? :generator + end end end diff --git a/lib/minitest/rails/assertions/action_cable.rb b/lib/minitest/rails/assertions/action_cable.rb index c767cf66..9203ed4b 100644 --- a/lib/minitest/rails/assertions/action_cable.rb +++ b/lib/minitest/rails/assertions/action_cable.rb @@ -25,7 +25,7 @@ class ActionCable::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_have_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: assert_broadcasts # :call-seq: assert_broadcasts(stream, number) @@ -52,7 +52,7 @@ class ActionCable::TestCase # assert_broadcasts 'messages', 0, &block # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: refute_broadcasts # :call-seq: refute_broadcasts(stream, &block) @@ -75,7 +75,7 @@ class ActionCable::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_broadcast_on - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: assert_broadcast_on # :call-seq: assert_broadcast_on(stream, data) @@ -108,7 +108,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_have_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: assert_broadcasts # :call-seq: assert_broadcasts(stream, number) @@ -135,7 +135,7 @@ class ActionCable::Channel::TestCase # assert_broadcasts 'messages', 0, &block # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: refute_broadcasts # :call-seq: refute_broadcasts(stream, &block) @@ -158,7 +158,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_broadcast_on - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: assert_broadcast_on # :call-seq: assert_broadcast_on(stream, data) @@ -172,7 +172,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#wont_have_streams - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams # # :method: refute_streams alias refute_streams assert_no_streams @@ -186,7 +186,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#must_have_streams - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream # # :method: assert_has_stream # :call-seq: assert_has_stream(stream) @@ -200,7 +200,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#must_have_stream_for - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for # # :method: assert_has_stream_for # :call-seq: assert_has_stream_for(object) @@ -226,7 +226,7 @@ class ActionCable::Connection::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable#must_reject_connection - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection # # :method: assert_reject_connection end diff --git a/lib/minitest/rails/assertions/action_mailer.rb b/lib/minitest/rails/assertions/action_mailer.rb index 2c22a276..55f7e5f1 100644 --- a/lib/minitest/rails/assertions/action_mailer.rb +++ b/lib/minitest/rails/assertions/action_mailer.rb @@ -25,7 +25,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_have_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_emails # # :method: assert_emails # :call-seq: assert_emails(number, &block) @@ -51,7 +51,7 @@ class ActionMailer::TestCase # assert_emails 0, &block # # See also Minitest::Rails::Expectations::ActionMailer#wont_have_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails # # :method: refute_emails # :call-seq: refute_emails(&block) @@ -84,7 +84,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_have_enqueued_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails # # :method: assert_enqueued_emails # :call-seq: assert_enqueued_emails(number, &block) @@ -122,7 +122,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_enqueue_email_with - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with # # :method: assert_enqueued_email_with # :call-seq: assert_enqueued_email_with(mailer, method, args: nil, queue: "mailers", &block) @@ -145,7 +145,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#wont_have_enqueued_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails # # :method: refute_enqueued_emails # :call-seq: refute_enqueued_emails(&block) diff --git a/lib/minitest/rails/assertions/active_support.rb b/lib/minitest/rails/assertions/active_support.rb index 10519061..dfa13277 100644 --- a/lib/minitest/rails/assertions/active_support.rb +++ b/lib/minitest/rails/assertions/active_support.rb @@ -8,7 +8,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#must_change - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes # # :method: assert_changes # :call-seq: assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block) @@ -22,7 +22,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#wont_change - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes # # :args: expression, message = nil, &block alias refute_changes assert_no_changes @@ -36,7 +36,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#must_change - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference # # :method: assert_difference # :call-seq: assert_difference(expression, *args, &block) @@ -50,7 +50,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#wont_change - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference # # :args: expression, message = nil, &block alias refute_difference assert_no_difference diff --git a/lib/minitest/rails/expectations/action_cable.rb b/lib/minitest/rails/expectations/action_cable.rb index 15bc2622..f5ad0ba7 100644 --- a/lib/minitest/rails/expectations/action_cable.rb +++ b/lib/minitest/rails/expectations/action_cable.rb @@ -31,7 +31,7 @@ module TestHelper # end # # See also ActionCable::TestHelper#assert_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: must_have_broadcasts # :call-seq: must_have_broadcasts(stream, number) @@ -58,7 +58,7 @@ module TestHelper # must_have_broadcasts 'messages', 0, &block # # See also ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: wont_have_broadcasts # :call-seq: wont_have_broadcasts(stream, &block) @@ -80,7 +80,7 @@ module TestHelper # end # # See also ActionCable::TestHelper#assert_broadcast_on - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: must_broadcast_on # :call-seq: must_broadcast_on(stream, data) @@ -104,7 +104,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_no_streams - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams # # :method: wont_have_streams @@ -117,7 +117,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_has_stream - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream # # :method: must_have_streams # :call-seq: must_have_streams(stream) @@ -131,7 +131,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_has_stream_for - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for # # :method: must_have_stream_for # :call-seq: must_have_stream_for(object) @@ -166,7 +166,7 @@ module Connection # end # # See also ActionCable::Connection::TestCase#assert_reject_connection - # See https://api.rubyonrails.org/v7.0/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection + # See https://api.rubyonrails.org/v7.1/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection # # :method: must_reject_connection diff --git a/lib/minitest/rails/expectations/action_mailer.rb b/lib/minitest/rails/expectations/action_mailer.rb index 0876bb9e..62375040 100644 --- a/lib/minitest/rails/expectations/action_mailer.rb +++ b/lib/minitest/rails/expectations/action_mailer.rb @@ -30,7 +30,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_emails # # :method: must_have_emails # :call-seq: must_have_emails(number, &block) @@ -56,7 +56,7 @@ module ActionMailer # must_have_emails 0, &block # # See also ActionMailer::TestClass#wont_have_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails # # :method: wont_have_emails # :call-seq: wont_have_emails(&block) @@ -88,7 +88,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_enqueued_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails # # :method: must_have_enqueued_emails # :call-seq: must_have_enqueued_emails(number, &block) @@ -126,7 +126,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_enqueued_email_with - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with # # :method: must_enqueue_email_with # :call-seq: must_enqueue_email_with(mailer, method, args: nil, queue: "mailers", &block) @@ -149,7 +149,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_no_enqueued_emails - # See https://api.rubyonrails.org/v7.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails + # See https://api.rubyonrails.org/v7.1/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails # # :method: wont_have_enqueued_emails # :call-seq: wont_have_enqueued_emails(&block) diff --git a/lib/minitest/rails/expectations/active_support.rb b/lib/minitest/rails/expectations/active_support.rb index a12a5f04..87bffccf 100644 --- a/lib/minitest/rails/expectations/active_support.rb +++ b/lib/minitest/rails/expectations/active_support.rb @@ -12,7 +12,7 @@ module ActiveSupport # end }.must_change "User.count", from: 5, to: 8 # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes # # :method: must_change # :args: expression, from: UNTRACKED, to: UNTRACKED @@ -27,7 +27,7 @@ module ActiveSupport # end # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes # # :method: wont_change # :args: expression @@ -43,7 +43,7 @@ module ActiveSupport # end }.must_differ "User.count", 3 # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference # # :method: must_differ # :args: expression, *args @@ -56,7 +56,7 @@ module ActiveSupport # value { User.new }.wont_differ "User.count" # # See also ActiveSupport::TestCase#refute_difference - # See https://api.rubyonrails.org/v7.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference + # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference # # :method: wont_differ # :args: expression diff --git a/lib/minitest/rails/version.rb b/lib/minitest/rails/version.rb index 12fd92ea..971a59b2 100644 --- a/lib/minitest/rails/version.rb +++ b/lib/minitest/rails/version.rb @@ -1,5 +1,5 @@ module Minitest module Rails - VERSION = "7.0.0".freeze + VERSION = "7.1.0".freeze end end diff --git a/minitest-rails.gemspec b/minitest-rails.gemspec index 03e56cdb..f1354fa6 100644 --- a/minitest-rails.gemspec +++ b/minitest-rails.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |gem| gem.email = ["mike@blowmage.com"] gem.description = "Adds Minitest as the default testing library in Rails" gem.summary = "Minitest integration for Rails" - gem.homepage = "http://blowmage.com/minitest-rails" + gem.homepage = "http://minitest.github.io/minitest-rails/" gem.license = "MIT" gem.files = `git ls-files -- lib/*`.split("\n") + @@ -17,13 +17,13 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.7.0" - gem.add_dependency "minitest", "~> 5.10" - gem.add_dependency "railties", "~> 7.0.0" + gem.add_dependency "minitest", "~> 5.20" + gem.add_dependency "railties", "~> 7.1.0" gem.add_development_dependency "minitest-autotest", "~> 1.1" - gem.add_development_dependency "minitest-focus", "~> 1.3" + gem.add_development_dependency "minitest-focus", "~> 1.4" gem.add_development_dependency "minitest-rg", "~> 5.2" - gem.add_development_dependency "rdoc", "~> 6.4" - gem.add_development_dependency "rubocop", "~> 1.28.0" + gem.add_development_dependency "rdoc", "~> 6.5" + gem.add_development_dependency "rubocop", "~> 1.57.0" gem.metadata["rubygems_mfa_required"] = "true" end diff --git a/test/generators/test_generator_generator.rb b/test/generators/test_generator_generator.rb index 30d1cac5..0b664e31 100644 --- a/test/generators/test_generator_generator.rb +++ b/test/generators/test_generator_generator.rb @@ -53,7 +53,7 @@ def test_generator_generator_spec Dir.chdir self.class.destination_root assert File.exist? "test/lib/generators/awesome_generator_test.rb" contents = File.read "test/lib/generators/awesome_generator_test.rb" - assert_match(/describe AwesomeGenerator do/m, contents) + assert_match(/describe AwesomeGenerator, :generator do/m, contents) end def test_namespaced_generator_generator_spec @@ -64,6 +64,6 @@ def test_namespaced_generator_generator_spec assert File.exist? "test/lib/generators/rails/awesome_generator_test.rb" contents = File.read "test/lib/generators/rails/awesome_generator_test.rb" - assert_match(/describe Rails::AwesomeGenerator do/m, contents) + assert_match(/describe Rails::AwesomeGenerator, :generator do/m, contents) end end diff --git a/test/helper.rb b/test/helper.rb index 8735489f..102d60f1 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -20,35 +20,13 @@ require "action_mailer" -require "minitest-rails" -require "rails/test_help" -require "minitest/rails" - -require "minitest/focus" - -require "rails/generators/test_case" -class GeneratorTest < ::Rails::Generators::TestCase - setup :set_destination - setup :prepare_destination - teardown :cleanup_destination - - def set_destination - self.class.destination Dir.mktmpdir - end - - def cleanup_destination - # puts "tree #{self.class.destination_root}" - # puts `tree #{self.class.destination_root}` - FileUtils.remove_entry self.class.destination_root - end -end - module TestApp class Application < ::Rails::Application config.active_support.test_order = :random config.secret_key_base = "abc123" config.hosts << "www.example.com" config.eager_load = false + config.load_defaults 7.1 end end @@ -109,7 +87,7 @@ def disconnect ActionMailer::Base.include(ActionView::Layouts) # Show backtraces for deprecated behavior for quicker cleanup. -ActiveSupport::Deprecation.debug = true +Rails.application.deprecators.debug = true # Disable available locale checks to avoid warnings running the test suite. I18n.enforce_available_locales = false @@ -141,3 +119,26 @@ class MyAppDeliveryJob < ActionMailer::MailDeliveryJob class MyAppDeliveryMailer < MyAppMailer self.delivery_job = MyAppDeliveryJob end + +require "minitest-rails" +require "rails/test_help" +require "minitest/rails" + +require "minitest/focus" + +require "rails/generators/test_case" +class GeneratorTest < Rails::Generators::TestCase + setup :set_destination + setup :prepare_destination + teardown :cleanup_destination + + def set_destination + self.class.destination Dir.mktmpdir + end + + def cleanup_destination + # puts "tree #{self.class.destination_root}" + # puts `tree #{self.class.destination_root}` + FileUtils.remove_entry self.class.destination_root + end +end