Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-rspec-rails for openSUSE:Factory checked in at 2022-02-24 18:20:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rspec-rails (Old) and /work/SRC/openSUSE:Factory/.rubygem-rspec-rails.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rspec-rails" Thu Feb 24 18:20:22 2022 rev:7 rq:956127 version:5.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rspec-rails/rubygem-rspec-rails.changes 2021-08-25 20:59:46.073038336 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-rspec-rails.new.1958/rubygem-rspec-rails.changes 2022-02-24 18:23:37.870655697 +0100 @@ -1,0 +2,7 @@ +Tue Feb 15 07:41:08 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 5.1.0 + see installed Changelog.md + + +------------------------------------------------------------------- Old: ---- rspec-rails-5.0.2.gem New: ---- rspec-rails-5.1.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rspec-rails.spec ++++++ --- /var/tmp/diff_new_pack.M0zqzw/_old 2022-02-24 18:23:38.278655590 +0100 +++ /var/tmp/diff_new_pack.M0zqzw/_new 2022-02-24 18:23:38.282655589 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-rspec-rails # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-rspec-rails -Version: 5.0.2 +Version: 5.1.0 Release: 0 %define mod_name rspec-rails %define mod_full_name %{mod_name}-%{version} ++++++ rspec-rails-5.0.2.gem -> rspec-rails-5.1.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Changelog.md new/Changelog.md --- old/Changelog.md 2021-08-14 10:29:28.000000000 +0200 +++ new/Changelog.md 2022-01-26 13:32:06.000000000 +0100 @@ -1,5 +1,25 @@ ### Development -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.2...5-0-maintenance) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.0...5-1-maintenance) + +### 5.1.0 / 2022-01-26 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.3...v5.1.0) + +Enhancements: + +* Make the API request scaffold template more consistent and compatible with + Rails 6.1. (Naoto Hamada, #2484) +* Change the scaffold `rails_helper.rb` template to use `require_relative`. + (Jon Dufresne, #2528) + +### 5.0.3 / 2022-01-26 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.2...v5.0.3) + +Bug Fixes: + +* Properly name params in controller and request spec templates when + using the `--model-name` parameter. (@kenzo-tanaka, #2534) +* Fix support for `have_enqueued_mail` on Ruby 3.1 with Rails 6.1. + (Fabio Napoleoni, Mikael Henriksson, Phil Pirozhkov, Jon Rowe, #2566) ### 5.0.2 / 2021-08-14 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...v5.0.2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2021-08-14 10:29:28.000000000 +0200 +++ new/README.md 2022-01-26 13:32:06.000000000 +0100 @@ -8,9 +8,11 @@ detailed explanations of how the application is supposed to behave, expressed in plain English. -Use **[`rspec-rails` 4.x][]** for Rails from 5.0 to 6.0. -Use **[`rspec-rails` 3.x][]** for Rails earlier than 5.0. -Use **[`rspec-rails` 1.x][]** for Rails 2.x. +According to [RSpec Rails new versioning strategy][] use: +* **[`rspec-rails` 5.x][]** for Rails 6.x. +* **[`rspec-rails` 4.x][]** for Rails from 5.x or 6.x. +* **[`rspec-rails` 3.x][]** for Rails earlier than 5.0. +* **[`rspec-rails` 1.x][]** for Rails 2.x. [Build Status]: https://secure.travis-ci.org/rspec/rspec-rails.svg?branch=main [travis-ci]: https://travis-ci.org/rspec/rspec-rails @@ -23,11 +25,13 @@ [`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails [`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance [`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance +[`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-0-maintenance +[RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md ## Installation -**IMPORTANT** This README / branch refers to the 5.0.x series of releases. -See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) for more up to date releases. +**IMPORTANT** This README / branch refers to the current development build. +See the [`5-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/5-0-maintenance) if you want or require the latest stable release. 1. Add `rspec-rails` to **both** the `:development` and `:test` groups of your app???s `Gemfile`: @@ -229,18 +233,18 @@ meaning the helper methods provided by default in Rails tests are available in RSpec, as well. - | Spec type | Corresponding Rails test class | - | -------------- | -------------------------------- | - | [model][] | | - | [controller][] | [`ActionController::TestCase`][] | - | [mailer][] | `ActionMailer::TestCase` | - | [job][] | | - | [view][] | `ActionView::TestCase` | - | [routing][] | | - | [helper][] | `ActionView::TestCase` | - | [request][] | [`ActionDispatch::IntegrationTest`][] | - | [feature][] | | - | [system][] | [`ActionDispatch::SystemTestCase`][] | +| Spec type | Corresponding Rails test class | +| -------------- | -------------------------------- | +| [model][] | | +| [controller][] | [`ActionController::TestCase`][] | +| [mailer][] | `ActionMailer::TestCase` | +| [job][] | | +| [view][] | `ActionView::TestCase` | +| [routing][] | | +| [helper][] | `ActionView::TestCase` | +| [request][] | [`ActionDispatch::IntegrationTest`][] | +| [feature][] | | +| [system][] | [`ActionDispatch::SystemTestCase`][] | Follow the links above to see examples of each spec type, or for official Rails API documentation on the given `TestCase` class. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ Binary files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ Binary files old/data.tar.gz.sig and new/data.tar.gz.sig differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/install/templates/spec/rails_helper.rb new/lib/generators/rspec/install/templates/spec/rails_helper.rb --- old/lib/generators/rspec/install/templates/spec/rails_helper.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/install/templates/spec/rails_helper.rb 2022-01-26 13:32:06.000000000 +0100 @@ -1,7 +1,7 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../config/environment', __dir__) +require_relative '../config/environment' # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rspec/rails' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/scaffold_generator.rb new/lib/generators/rspec/scaffold/scaffold_generator.rb --- old/lib/generators/rspec/scaffold/scaffold_generator.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/scaffold/scaffold_generator.rb 2022-01-26 13:32:06.000000000 +0100 @@ -127,6 +127,10 @@ def banner self.class.banner end + + def show_helper(resource_name = file_name) + "#{singular_route_name}_url(#{resource_name})" + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/api_controller_spec.rb new/lib/generators/rspec/scaffold/templates/api_controller_spec.rb --- old/lib/generators/rspec/scaffold/templates/api_controller_spec.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/scaffold/templates/api_controller_spec.rb 2022-01-26 13:32:06.000000000 +0100 @@ -64,21 +64,21 @@ context "with valid params" do it "creates a new <%= class_name %>" do expect { - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session }.to change(<%= class_name %>, :count).by(1) end - it "renders a JSON response with the new <%= ns_file_name %>" do - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session + it "renders a JSON response with the new <%= singular_table_name %>" do + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session expect(response).to have_http_status(:created) expect(response.content_type).to eq('application/json') - expect(response.location).to eq(<%= ns_file_name %>_url(<%= class_name %>.last)) + expect(response.location).to eq(<%= singular_table_name %>_url(<%= class_name %>.last)) end end context "with invalid params" do - it "renders a JSON response with errors for the new <%= ns_file_name %>" do - post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session + it "renders a JSON response with errors for the new <%= singular_table_name %>" do + post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session expect(response).to have_http_status(:unprocessable_entity) expect(response.content_type).to eq('application/json') end @@ -91,25 +91,25 @@ skip("Add a hash of attributes valid for your model") } - it "updates the requested <%= ns_file_name %>" do + it "updates the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session <%= file_name %>.reload skip("Add assertions for updated state") end - it "renders a JSON response with the <%= ns_file_name %>" do + it "renders a JSON response with the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session expect(response).to have_http_status(:ok) expect(response.content_type).to eq('application/json') end end context "with invalid params" do - it "renders a JSON response with errors for the <%= ns_file_name %>" do + it "renders a JSON response with errors for the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session expect(response).to have_http_status(:unprocessable_entity) expect(response.content_type).to eq('application/json') end @@ -117,7 +117,7 @@ end describe "DELETE #destroy" do - it "destroys the requested <%= ns_file_name %>" do + it "destroys the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes expect { delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/api_request_spec.rb new/lib/generators/rspec/scaffold/templates/api_request_spec.rb --- old/lib/generators/rspec/scaffold/templates/api_request_spec.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/scaffold/templates/api_request_spec.rb 2022-01-26 13:32:06.000000000 +0100 @@ -46,7 +46,7 @@ describe "GET /show" do it "renders a successful response" do <%= file_name %> = <%= class_name %>.create! valid_attributes - get <%= show_helper.tr('@', '') %>, as: :json + get <%= show_helper %>, as: :json expect(response).to be_successful end end @@ -56,13 +56,13 @@ it "creates a new <%= class_name %>" do expect { post <%= index_helper %>_url, - params: { <%= ns_file_name %>: valid_attributes }, headers: valid_headers, as: :json + params: { <%= singular_table_name %>: valid_attributes }, headers: valid_headers, as: :json }.to change(<%= class_name %>, :count).by(1) end - it "renders a JSON response with the new <%= ns_file_name %>" do + it "renders a JSON response with the new <%= singular_table_name %>" do post <%= index_helper %>_url, - params: { <%= ns_file_name %>: valid_attributes }, headers: valid_headers, as: :json + params: { <%= singular_table_name %>: valid_attributes }, headers: valid_headers, as: :json expect(response).to have_http_status(:created) expect(response.content_type).to match(a_string_including("application/json")) end @@ -72,15 +72,15 @@ it "does not create a new <%= class_name %>" do expect { post <%= index_helper %>_url, - params: { <%= ns_file_name %>: invalid_attributes }, as: :json + params: { <%= singular_table_name %>: invalid_attributes }, as: :json }.to change(<%= class_name %>, :count).by(0) end - it "renders a JSON response with errors for the new <%= ns_file_name %>" do + it "renders a JSON response with errors for the new <%= singular_table_name %>" do post <%= index_helper %>_url, - params: { <%= ns_file_name %>: invalid_attributes }, headers: valid_headers, as: :json + params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json expect(response).to have_http_status(:unprocessable_entity) - expect(response.content_type).to eq("application/json") + expect(response.content_type).to match(a_string_including("application/json")) end end end @@ -91,17 +91,17 @@ skip("Add a hash of attributes valid for your model") } - it "updates the requested <%= ns_file_name %>" do + it "updates the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, + patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json <%= file_name %>.reload skip("Add assertions for updated state") end - it "renders a JSON response with the <%= ns_file_name %>" do + it "renders a JSON response with the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, + patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json expect(response).to have_http_status(:ok) expect(response.content_type).to match(a_string_including("application/json")) @@ -109,21 +109,21 @@ end context "with invalid parameters" do - it "renders a JSON response with errors for the <%= ns_file_name %>" do + it "renders a JSON response with errors for the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, + patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json expect(response).to have_http_status(:unprocessable_entity) - expect(response.content_type).to eq("application/json") + expect(response.content_type).to match(a_string_including("application/json")) end end end describe "DELETE /destroy" do - it "destroys the requested <%= ns_file_name %>" do + it "destroys the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes expect { - delete <%= show_helper.tr('@', '') %>, headers: valid_headers, as: :json + delete <%= show_helper %>, headers: valid_headers, as: :json }.to change(<%= class_name %>, :count).by(-1) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/controller_spec.rb new/lib/generators/rspec/scaffold/templates/controller_spec.rb --- old/lib/generators/rspec/scaffold/templates/controller_spec.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/scaffold/templates/controller_spec.rb 2022-01-26 13:32:06.000000000 +0100 @@ -79,19 +79,19 @@ context "with valid params" do it "creates a new <%= class_name %>" do expect { - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session }.to change(<%= class_name %>, :count).by(1) end - it "redirects to the created <%= ns_file_name %>" do - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session + it "redirects to the created <%= singular_table_name %>" do + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session expect(response).to redirect_to(<%= class_name %>.last) end end context "with invalid params" do it "returns a success response (i.e. to display the 'new' template)" do - post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session + post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session expect(response).to be_successful end end @@ -103,16 +103,16 @@ skip("Add a hash of attributes valid for your model") } - it "updates the requested <%= ns_file_name %>" do + it "updates the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session <%= file_name %>.reload skip("Add assertions for updated state") end - it "redirects to the <%= ns_file_name %>" do + it "redirects to the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session expect(response).to redirect_to(<%= file_name %>) end end @@ -120,14 +120,14 @@ context "with invalid params" do it "returns a success response (i.e. to display the 'edit' template)" do <%= file_name %> = <%= class_name %>.create! valid_attributes - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session expect(response).to be_successful end end end describe "DELETE #destroy" do - it "destroys the requested <%= ns_file_name %>" do + it "destroys the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes expect { delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/request_spec.rb new/lib/generators/rspec/scaffold/templates/request_spec.rb --- old/lib/generators/rspec/scaffold/templates/request_spec.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/generators/rspec/scaffold/templates/request_spec.rb 2022-01-26 13:32:06.000000000 +0100 @@ -1,4 +1,4 @@ - require 'rails_helper' +require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to test the controller code that @@ -18,6 +18,7 @@ include Engine.routes.url_helpers <% end -%> + # This should return the minimal set of attributes required to create a valid # <%= class_name %>. As you add validations to <%= class_name %>, be sure to # adjust the attributes here as well. let(:valid_attributes) { @@ -41,7 +42,7 @@ describe "GET /show" do it "renders a successful response" do <%= file_name %> = <%= class_name %>.create! valid_attributes - get <%= show_helper.tr('@', '') %> + get <%= show_helper %> expect(response).to be_successful end end @@ -54,9 +55,9 @@ end describe "GET /edit" do - it "render a successful response" do + it "renders a successful response" do <%= file_name %> = <%= class_name %>.create! valid_attributes - get <%= edit_helper.tr('@','') %> + get <%= edit_helper %> expect(response).to be_successful end end @@ -65,25 +66,25 @@ context "with valid parameters" do it "creates a new <%= class_name %>" do expect { - post <%= index_helper %>_url, params: { <%= ns_file_name %>: valid_attributes } + post <%= index_helper %>_url, params: { <%= singular_table_name %>: valid_attributes } }.to change(<%= class_name %>, :count).by(1) end - it "redirects to the created <%= ns_file_name %>" do - post <%= index_helper %>_url, params: { <%= ns_file_name %>: valid_attributes } - expect(response).to redirect_to(<%= show_helper.gsub("\@#{file_name}", class_name+".last") %>) + it "redirects to the created <%= singular_table_name %>" do + post <%= index_helper %>_url, params: { <%= singular_table_name %>: valid_attributes } + expect(response).to redirect_to(<%= show_helper(class_name+".last") %>) end end context "with invalid parameters" do it "does not create a new <%= class_name %>" do expect { - post <%= index_helper %>_url, params: { <%= ns_file_name %>: invalid_attributes } + post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes } }.to change(<%= class_name %>, :count).by(0) end it "renders a successful response (i.e. to display the 'new' template)" do - post <%= index_helper %>_url, params: { <%= ns_file_name %>: invalid_attributes } + post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes } expect(response).to be_successful end end @@ -95,16 +96,16 @@ skip("Add a hash of attributes valid for your model") } - it "updates the requested <%= ns_file_name %>" do + it "updates the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: new_attributes } + patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes } <%= file_name %>.reload skip("Add assertions for updated state") end - it "redirects to the <%= ns_file_name %>" do + it "redirects to the <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: new_attributes } + patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes } <%= file_name %>.reload expect(response).to redirect_to(<%= singular_table_name %>_url(<%= file_name %>)) end @@ -113,23 +114,23 @@ context "with invalid parameters" do it "renders a successful response (i.e. to display the 'edit' template)" do <%= file_name %> = <%= class_name %>.create! valid_attributes - patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: invalid_attributes } + patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes } expect(response).to be_successful end end end describe "DELETE /destroy" do - it "destroys the requested <%= ns_file_name %>" do + it "destroys the requested <%= singular_table_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes expect { - delete <%= show_helper.tr('@', '') %> + delete <%= show_helper %> }.to change(<%= class_name %>, :count).by(-1) end it "redirects to the <%= table_name %> list" do <%= file_name %> = <%= class_name %>.create! valid_attributes - delete <%= show_helper.tr('@', '') %> + delete <%= show_helper %> expect(response).to redirect_to(<%= index_helper %>_url) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/matchers/have_enqueued_mail.rb new/lib/rspec/rails/matchers/have_enqueued_mail.rb --- old/lib/rspec/rails/matchers/have_enqueued_mail.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/rspec/rails/matchers/have_enqueued_mail.rb 2022-01-26 13:32:06.000000000 +0100 @@ -4,6 +4,7 @@ require "rspec/mocks/argument_matchers" require "rspec/rails/matchers/active_job" +# rubocop: disable Metrics/ClassLength module RSpec module Rails module Matchers @@ -119,9 +120,11 @@ end def mail_job_message(job) - mailer_method = job[:args][0..1].join('.') + job_args = deserialize_arguments(job) + + mailer_method = job_args[0..1].join('.') + mailer_args = job_args[3..-1] - mailer_args = job[:args][3..-1] msg_parts = [] msg_parts << "with #{mailer_args}" if mailer_args.any? msg_parts << "on queue #{job[:queue]}" if job[:queue] && job[:queue] != 'mailers' @@ -130,6 +133,30 @@ "#{mailer_method} #{msg_parts.join(', ')}".strip end + # Ruby 3.1 changed how params were serialized on Rails 6.1 + # so we override the active job implementation and customise it here. + def deserialize_arguments(job) + args = super + + return args unless Hash === args.last + + hash = args.pop + + if hash.key?("_aj_ruby2_keywords") + keywords = hash["_aj_ruby2_keywords"] + + original_hash = keywords.each_with_object({}) { |new_hash, keyword| new_hash[keyword.to_sym] = hash[keyword] } + + args + [original_hash] + elsif hash.key?(:args) && hash.key?(:params) + args + [hash] + elsif hash.key?(:args) + args + hash[:args] + else + args + [hash] + end + end + def legacy_mail?(job) job[:job] <= ActionMailer::DeliveryJob end @@ -196,3 +223,4 @@ end end end +# rubocop: enable Metrics/ClassLength diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/matchers/have_http_status.rb new/lib/rspec/rails/matchers/have_http_status.rb --- old/lib/rspec/rails/matchers/have_http_status.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/rspec/rails/matchers/have_http_status.rb 2022-01-26 13:32:06.000000000 +0100 @@ -1,6 +1,6 @@ # The following code inspired and modified from Rails' `assert_response`: # -# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/assertions/response.rb#L22-L38 +# https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/testing/assertions/response.rb#L22-L38 # # Thank you to all the Rails devs who did the heavy lifting on this! @@ -243,7 +243,7 @@ # @return [Array<Symbol>] of status codes which represent a HTTP status # code "group" - # @see https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` + # @see https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` def self.valid_statuses [ :error, :success, :missing, @@ -313,7 +313,7 @@ # @return [String] formatting the associated code(s) for the various # status code "groups" - # @see https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` + # @see https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` # @see https://github.com/rack/rack/blob/master/lib/rack/response.rb `Rack::Response` def type_codes # At the time of this commit the most recent version of @@ -373,7 +373,7 @@ # expect(response).to have_http_status(404) # expect(page).to have_http_status(:created) # - # @see https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` + # @see https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` # @see https://github.com/rack/rack/blob/master/lib/rack/utils.rb `Rack::Utils::SYMBOL_TO_STATUS_CODE` def have_http_status(target) raise ArgumentError, "Invalid HTTP status: nil" unless target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/version.rb new/lib/rspec/rails/version.rb --- old/lib/rspec/rails/version.rb 2021-08-14 10:29:28.000000000 +0200 +++ new/lib/rspec/rails/version.rb 2022-01-26 13:32:06.000000000 +0100 @@ -3,7 +3,7 @@ # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. - STRING = '5.0.2' + STRING = '5.1.0' end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-08-14 10:29:28.000000000 +0200 +++ new/metadata 2022-01-26 13:32:06.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rspec-rails version: !ruby/object:Gem::Version - version: 5.0.2 + version: 5.1.0 platform: ruby authors: - David Chelimsky @@ -44,7 +44,7 @@ ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ F3MdtaDehhjC -----END CERTIFICATE----- -date: 2021-08-14 00:00:00.000000000 Z +date: 2022-01-26 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: actionpack @@ -176,16 +176,28 @@ name: cucumber requirement: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" + - !ruby/object:Gem::Version + version: '3.2' + - - "!=" + - !ruby/object:Gem::Version + version: 4.0.0 + - - "<" - !ruby/object:Gem::Version - version: 1.3.5 + version: 8.0.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" + - !ruby/object:Gem::Version + version: '3.2' + - - "!=" + - !ruby/object:Gem::Version + version: 4.0.0 + - - "<" - !ruby/object:Gem::Version - version: 1.3.5 + version: 8.0.0 description: rspec-rails is a testing framework for Rails 5+. email: rs...@googlegroups.com executables: [] @@ -296,7 +308,7 @@ - MIT metadata: bug_tracker_uri: https://github.com/rspec/rspec-rails/issues - changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.0.2/Changelog.md + changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.1.0/Changelog.md documentation_uri: https://rspec.info/documentation/ mailing_list_uri: https://groups.google.com/forum/#!forum/rspec source_code_uri: https://github.com/rspec/rspec-rails @@ -316,7 +328,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.2.22 +rubygems_version: 3.3.3 signing_key: specification_version: 4 summary: RSpec for Rails Binary files old/metadata.gz.sig and new/metadata.gz.sig differ