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 2021-03-15 10:56:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rspec-rails (Old) and /work/SRC/openSUSE:Factory/.rubygem-rspec-rails.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rspec-rails" Mon Mar 15 10:56:20 2021 rev:4 rq:879034 version:5.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rspec-rails/rubygem-rspec-rails.changes 2021-01-25 18:23:37.984429846 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-rspec-rails.new.2401/rubygem-rspec-rails.changes 2021-03-15 10:56:21.497352030 +0100 @@ -1,0 +2,16 @@ +Mon Mar 15 04:21:34 UTC 2021 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 5.0.0 + + [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...v5.0.0) + + Enhancements: + + * Support new #file_fixture_path and new fixture test support code. (Jon Rowe, #2398) + * Support for Rails 6.1. (Benoit Tigeot, Jon Rowe, Phil Pirozhkov, and more #2398) + + Breaking Changes: + + * Drop support for Rails below 5.2. + +------------------------------------------------------------------- Old: ---- rspec-rails-4.0.2.gem New: ---- rspec-rails-5.0.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rspec-rails.spec ++++++ --- /var/tmp/diff_new_pack.u6mso8/_old 2021-03-15 10:56:23.049354412 +0100 +++ /var/tmp/diff_new_pack.u6mso8/_new 2021-03-15 10:56:23.049354412 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-rspec-rails -Version: 4.0.2 +Version: 5.0.0 Release: 0 %define mod_name rspec-rails %define mod_full_name %{mod_name}-%{version} ++++++ rspec-rails-4.0.2.gem -> rspec-rails-5.0.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Changelog.md new/Changelog.md --- old/Changelog.md 2020-12-26 18:41:39.000000000 +0100 +++ new/Changelog.md 2021-03-09 09:50:41.000000000 +0100 @@ -1,3 +1,38 @@ +### 5.0.0 / 2021-03-09 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...main) + +Enhancements: + +* Support new #file_fixture_path and new fixture test support code. (Jon Rowe, #2398) +* Support for Rails 6.1. (Benoit Tigeot, Jon Rowe, Phil Pirozhkov, and more #2398) + +Breaking Changes: + +* Drop support for Rails below 5.2. + +### 4.1.1 / 2021-03-09 + +Bug Fixes: + +* Remove generated specs when destroying a generated controller. + (@Naokimi, #2475) + +### 4.1.0 / 2021-03-06 + +Enhancements: + +* Issue a warning when using job matchers with `#at` mis-match on `usec` precision. + (Jon Rowe, #2350) +* Generated request specs now have a bare `_spec` suffix instead of `request_spec`. + (Eloy Espinaco, Luka L??dicke, #2355, #2356, #2378) +* Generated scaffold now includes engine route helpers when inside a mountable engine. + (Andrew W. Lee, #2372) +* Improve request spec "controller" scafold when no action is specified. + (Thomas Hareau, #2399) +* Introduce testing snippets concept (Phil Pirozhkov, Benoit Tigeot, #2423) +* Prevent collisions with `let(:name)` for Rails 6.1 and `let(:method_name)` on older + Rails. (Benoit Tigeot, #2461) + ### 4.0.2 / 2020-12-26 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.1...v4.0.2) @@ -9,6 +44,7 @@ (Phil Pirozhkov, Jon Rowe, #2353, #2354) * Remove old #fixture_path feature detection code which broke under newer Rails. (Koen Punt, Jon Rowe, #2370) +* Fix an error when `use_active_record` is `false` (Phil Pirozhkov, #2423) ### 4.0.1 / 2020-05-16 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0...v4.0.1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2020-12-26 18:41:39.000000000 +0100 +++ new/README.md 2021-03-09 09:50:41.000000000 +0100 @@ -1,4 +1,4 @@ -# rspec-rails [![Build Status][]][travis-ci] [![Code Climate][]][code-climate] [![Gem Version][]](gem-version) +# rspec-rails [![Code Climate][]][code-climate] [![Gem Version][]][gem-version] `rspec-rails` brings the [RSpec][] testing framework to [Ruby on Rails][] as a drop-in alternative to its default testing framework, Minitest. @@ -24,13 +24,16 @@ ## Installation +**IMPORTANT** This README / branch refers to the current development build. +See the [`4-1-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/4-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`: ```ruby # Run against the latest stable release group :development, :test do - gem 'rspec-rails', '~> 4.0.1' + gem 'rspec-rails', '~> 4.1.0' end # Or, run against the main branch 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/controller/controller_generator.rb new/lib/generators/rspec/controller/controller_generator.rb --- old/lib/generators/rspec/controller/controller_generator.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/controller/controller_generator.rb 2021-03-09 09:50:41.000000000 +0100 @@ -16,7 +16,7 @@ return unless options[:request_specs] template 'request_spec.rb', - File.join('spec/requests', class_path, "#{file_name}_request_spec.rb") + File.join('spec/requests', class_path, "#{file_name}_spec.rb") end def generate_controller_spec @@ -27,7 +27,7 @@ end def generate_view_specs - return if actions.empty? + return if actions.empty? && behavior == :invoke return unless options[:view_specs] && options[:template_engine] empty_directory File.join("spec", "views", file_path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/controller/templates/request_spec.rb new/lib/generators/rspec/controller/templates/request_spec.rb --- old/lib/generators/rspec/controller/templates/request_spec.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/controller/templates/request_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -1,7 +1,12 @@ require 'rails_helper' RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do -<% namespaced_path = regular_class_path.join('/') %> +<% namespaced_path = regular_class_path.join('/') -%> +<% if actions.empty? -%> + describe "GET /index" do + pending "add some examples (or delete) #{__FILE__}" + end +<% end -%> <% for action in actions -%> describe "GET /<%= action %>" do it "returns http success" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/mailer/templates/mailer_spec.rb new/lib/generators/rspec/mailer/templates/mailer_spec.rb --- old/lib/generators/rspec/mailer/templates/mailer_spec.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/mailer/templates/mailer_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -1,10 +1,10 @@ require "rails_helper" <% module_namespacing do -%> -RSpec.describe <%= Rails.version.to_f >= 5.0 ? class_name.sub(/(Mailer)?$/, 'Mailer') : class_name %>, <%= type_metatag(:mailer) %> do +RSpec.describe <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>, <%= type_metatag(:mailer) %> do <% for action in actions -%> describe "<%= action %>" do - let(:mail) { <%= Rails.version.to_f >= 5.0 ? class_name.sub(/(Mailer)?$/, 'Mailer') : class_name %>.<%= action %> } + let(:mail) { <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %> } it "renders the headers" do expect(mail.subject).to eq(<%= action.to_s.humanize.inspect %>) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/mailer/templates/preview.rb new/lib/generators/rspec/mailer/templates/preview.rb --- old/lib/generators/rspec/mailer/templates/preview.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/mailer/templates/preview.rb 2021-03-09 09:50:41.000000000 +0100 @@ -5,7 +5,7 @@ # Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %> def <%= action %> - <%= Rails.version.to_f >= 5.0 ? class_name.sub(/(Mailer)?$/, 'Mailer') : class_name %>.<%= action %> + <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %> 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 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/scaffold/templates/controller_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -46,11 +46,7 @@ describe "GET #index" do it "returns a success response" do <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - get :index, {}, valid_session -<% else -%> get :index, params: {}, session: valid_session -<% end -%> expect(response).to be_successful end end @@ -59,22 +55,14 @@ describe "GET #show" do it "returns a success response" do <%= file_name %> = <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - get :show, {id: <%= file_name %>.to_param}, valid_session -<% else -%> get :show, params: {id: <%= file_name %>.to_param}, session: valid_session -<% end -%> expect(response).to be_successful end end describe "GET #new" do it "returns a success response" do -<% if Rails::VERSION::STRING < '5.0' -%> - get :new, {}, valid_session -<% else -%> get :new, params: {}, session: valid_session -<% end -%> expect(response).to be_successful end end @@ -82,11 +70,7 @@ describe "GET #edit" do it "returns a success response" do <%= file_name %> = <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - get :edit, {id: <%= file_name %>.to_param}, valid_session -<% else -%> get :edit, params: {id: <%= file_name %>.to_param}, session: valid_session -<% end -%> expect(response).to be_successful end end @@ -95,31 +79,19 @@ context "with valid params" do it "creates a new <%= class_name %>" do expect { -<% if Rails::VERSION::STRING < '5.0' -%> - post :create, {<%= ns_file_name %>: valid_attributes}, valid_session -<% else -%> post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session -<% end -%> }.to change(<%= class_name %>, :count).by(1) end it "redirects to the created <%= ns_file_name %>" do -<% if Rails::VERSION::STRING < '5.0' -%> - post :create, {<%= ns_file_name %>: valid_attributes}, valid_session -<% else -%> post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session -<% end -%> 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 -<% if Rails::VERSION::STRING < '5.0' -%> - post :create, {<%= ns_file_name %>: invalid_attributes}, valid_session -<% else -%> post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session -<% end -%> expect(response).to be_successful end end @@ -133,22 +105,14 @@ it "updates the requested <%= ns_file_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, valid_session -<% else -%> put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session -<% end -%> <%= file_name %>.reload skip("Add assertions for updated state") end it "redirects to the <%= ns_file_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, valid_session -<% else -%> put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session -<% end -%> expect(response).to redirect_to(<%= file_name %>) end end @@ -156,11 +120,7 @@ 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 -<% if Rails::VERSION::STRING < '5.0' -%> - put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, valid_session -<% else -%> put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session -<% end -%> expect(response).to be_successful end end @@ -170,21 +130,13 @@ it "destroys the requested <%= ns_file_name %>" do <%= file_name %> = <%= class_name %>.create! valid_attributes expect { -<% if Rails::VERSION::STRING < '5.0' -%> - delete :destroy, {id: <%= file_name %>.to_param}, valid_session -<% else -%> delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session -<% end -%> }.to change(<%= class_name %>, :count).by(-1) end it "redirects to the <%= table_name %> list" do <%= file_name %> = <%= class_name %>.create! valid_attributes -<% if Rails::VERSION::STRING < '5.0' -%> - delete :destroy, {id: <%= file_name %>.to_param}, valid_session -<% else -%> delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session -<% end -%> expect(response).to redirect_to(<%= index_helper %>_url) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/edit_spec.rb new/lib/generators/rspec/scaffold/templates/edit_spec.rb --- old/lib/generators/rspec/scaffold/templates/edit_spec.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/scaffold/templates/edit_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -16,11 +16,7 @@ assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= ns_file_name %>), "post" do <% for attribute in output_attributes -%> <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %> -<% if Rails.version.to_f >= 5.1 -%> assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]" -<% else -%> - assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]" -<% end -%> <% end -%> end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/scaffold/templates/new_spec.rb new/lib/generators/rspec/scaffold/templates/new_spec.rb --- old/lib/generators/rspec/scaffold/templates/new_spec.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/scaffold/templates/new_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -15,11 +15,7 @@ assert_select "form[action=?][method=?]", <%= index_helper %>_path, "post" do <% for attribute in output_attributes -%> <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %> -<% if Rails.version.to_f >= 5.1 -%> assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]" -<% else -%> - assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]" -<% end -%> <% end -%> end end 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 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/scaffold/templates/request_spec.rb 2021-03-09 09:50:41.000000000 +0100 @@ -14,6 +14,10 @@ <% module_namespacing do -%> RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do + <% if mountable_engine? -%> + include Engine.routes.url_helpers + <% end -%> + # <%= class_name %>. As you add validations to <%= class_name %>, be sure to # adjust the attributes here as well. let(:valid_attributes) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/rspec/system/system_generator.rb new/lib/generators/rspec/system/system_generator.rb --- old/lib/generators/rspec/system/system_generator.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/generators/rspec/system/system_generator.rb 2021-03-09 09:50:41.000000000 +0100 @@ -1,25 +1,23 @@ require 'generators/rspec' -if ::Rails::VERSION::STRING >= '5.1' - module Rspec - module Generators - # @private - class SystemGenerator < Base - class_option :system_specs, type: :boolean, default: true, desc: "Generate system specs" +module Rspec + module Generators + # @private + class SystemGenerator < Base + class_option :system_specs, type: :boolean, default: true, desc: "Generate system specs" - def generate_system_spec - return unless options[:system_specs] + def generate_system_spec + return unless options[:system_specs] - template template_name, File.join('spec/system', class_path, filename) - end + template template_name, File.join('spec/system', class_path, filename) + end - def template_name - 'system_spec.rb' - end + def template_name + 'system_spec.rb' + end - def filename - "#{table_name}_spec.rb" - end + def filename + "#{table_name}_spec.rb" end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/configuration.rb new/lib/rspec/rails/configuration.rb --- old/lib/rspec/rails/configuration.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/configuration.rb 2021-03-09 09:50:41.000000000 +0100 @@ -80,10 +80,8 @@ # `RSpec::Rails::FixtureSupport` directly instead config.include RSpec::Rails::FixtureSupport - if ::Rails::VERSION::STRING > '5' - config.add_setting :file_fixture_path, default: 'spec/fixtures/files' - config.include RSpec::Rails::FileFixtureSupport - end + config.add_setting :file_fixture_path, default: 'spec/fixtures/files' + config.include RSpec::Rails::FileFixtureSupport # Add support for fixture_path on fixture_file_upload config.include RSpec::Rails::FixtureFileUploadSupport diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/example/request_example_group.rb new/lib/rspec/rails/example/request_example_group.rb --- old/lib/rspec/rails/example/request_example_group.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/example/request_example_group.rb 2021-03-09 09:50:41.000000000 +0100 @@ -10,10 +10,7 @@ include RSpec::Rails::Matchers::RedirectTo include RSpec::Rails::Matchers::RenderTemplate include ActionController::TemplateAssertions - - if ActionPack::VERSION::MAJOR >= 5 - include ActionDispatch::IntegrationTest::Behavior - end + include ActionDispatch::IntegrationTest::Behavior # Delegates to `Rails.application`. def app diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/file_fixture_support.rb new/lib/rspec/rails/file_fixture_support.rb --- old/lib/rspec/rails/file_fixture_support.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/file_fixture_support.rb 2021-03-09 09:50:41.000000000 +0100 @@ -1,16 +1,14 @@ -if ::Rails::VERSION::STRING > '5' - require 'active_support/testing/file_fixtures' +require 'active_support/testing/file_fixtures' - module RSpec - module Rails - # @private - module FileFixtureSupport - extend ActiveSupport::Concern - include ActiveSupport::Testing::FileFixtures +module RSpec + module Rails + # @private + module FileFixtureSupport + extend ActiveSupport::Concern + include ActiveSupport::Testing::FileFixtures - included do - self.file_fixture_path = RSpec.configuration.file_fixture_path - end + included do + self.file_fixture_path = RSpec.configuration.file_fixture_path end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/fixture_file_upload_support.rb new/lib/rspec/rails/fixture_file_upload_support.rb --- old/lib/rspec/rails/fixture_file_upload_support.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/fixture_file_upload_support.rb 2021-03-09 09:50:41.000000000 +0100 @@ -6,21 +6,42 @@ private - def rails_fixture_file_wrapper - RailsFixtureFileWrapper.fixture_path = nil - resolved_fixture_path = - if respond_to?(:fixture_path) && !fixture_path.nil? - fixture_path.to_s - else - (RSpec.configuration.fixture_path || '').to_s - end - RailsFixtureFileWrapper.fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty? - RailsFixtureFileWrapper.instance + # In Rails 6.2 fixture file path needs to be relative to `file_fixture_path` instead, this change + # was brought in with a deprecation warning on 6.1. In Rails 6.2 expect to rework this to remove + # the old accessor. + if ::Rails.version.to_f >= 6.1 + def rails_fixture_file_wrapper + RailsFixtureFileWrapper.file_fixture_path = nil + resolved_fixture_path = + if respond_to?(:file_fixture_path) && !file_fixture_path.nil? + file_fixture_path.to_s + else + (RSpec.configuration.fixture_path || '').to_s + end + RailsFixtureFileWrapper.file_fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty? + RailsFixtureFileWrapper.instance + end + else + def rails_fixture_file_wrapper + RailsFixtureFileWrapper.fixture_path = nil + resolved_fixture_path = + if respond_to?(:fixture_path) && !fixture_path.nil? + fixture_path.to_s + else + (RSpec.configuration.fixture_path || '').to_s + end + RailsFixtureFileWrapper.fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty? + RailsFixtureFileWrapper.instance + end end class RailsFixtureFileWrapper include ActionDispatch::TestProcess if defined?(ActionDispatch::TestProcess) + if ::Rails.version.to_f >= 6.1 + include ActiveSupport::Testing::FileFixtures + end + class << self attr_accessor :fixture_path diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/fixture_support.rb new/lib/rspec/rails/fixture_support.rb --- old/lib/rspec/rails/fixture_support.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/fixture_support.rb 2021-03-09 09:50:41.000000000 +0100 @@ -9,16 +9,19 @@ include RSpec::Rails::MinitestAssertionAdapter include ActiveRecord::TestFixtures + # @private prevent ActiveSupport::TestFixtures to start a DB transaction. + # Monkey patched to avoid collisions with 'let(:name)' in Rails 6.1 and after + # and let(:method_name) before Rails 6.1. + def run_in_transaction? + use_transactional_tests && !self.class.uses_transaction?(self) + end + included do if RSpec.configuration.use_active_record? include Fixtures self.fixture_path = RSpec.configuration.fixture_path - if ::Rails::VERSION::STRING > '5' - self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures - else - self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures - end + self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures @@ -50,13 +53,6 @@ end end end - - if ::Rails.version.to_f >= 6.1 - # @private return the example name for TestFixtures - def name - @example - end - end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/matchers/action_mailbox.rb new/lib/rspec/rails/matchers/action_mailbox.rb --- old/lib/rspec/rails/matchers/action_mailbox.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/matchers/action_mailbox.rb 2021-03-09 09:50:41.000000000 +0100 @@ -22,11 +22,20 @@ @inbound_email = create_inbound_email(message) end - def matches?(mailbox) - @mailbox = mailbox - @receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email) + if defined?(::ApplicationMailbox) && ::ApplicationMailbox.router.respond_to?(:mailbox_for) + def matches?(mailbox) + @mailbox = mailbox + @receiver = ApplicationMailbox.router.mailbox_for(inbound_email) - @receiver == @mailbox + @receiver == @mailbox + end + else + def matches?(mailbox) + @mailbox = mailbox + @receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email) + + @receiver == @mailbox + end end def failure_message @@ -41,7 +50,7 @@ "expected #{describe_inbound_email} not to route to #{mailbox}" end - private + private attr_reader :inbound_email, :mailbox, :receiver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec/rails/matchers/active_job.rb new/lib/rspec/rails/matchers/active_job.rb --- old/lib/rspec/rails/matchers/active_job.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/matchers/active_job.rb 2021-03-09 09:50:41.000000000 +0100 @@ -163,7 +163,29 @@ return job[:at].nil? if @at == :no_wait return false unless job[:at] - values_match?(@at, Time.at(job[:at])) + scheduled_at = Time.at(job[:at]) + values_match?(@at, scheduled_at) || check_for_inprecise_value(scheduled_at) + end + + def check_for_inprecise_value(scheduled_at) + return unless Time === @at && values_match?(@at.change(usec: 0), scheduled_at) + + RSpec.warn_with((<<-WARNING).gsub(/^\s+\|/, '').chomp) + |[WARNING] Your expected `at(...)` value does not match the job scheduled_at value + |unless microseconds are removed. This precision error often occurs when checking + |values against `Time.current` / `Time.now` which have usec precision, but Rails + |uses `n.seconds.from_now` internally which has a usec count of `0`. + | + |Use `change(usec: 0)` to correct these values. For example: + | + |`Time.current.change(usec: 0)` + | + |Note: RSpec cannot do this for you because jobs can be scheduled with usec + |precision and we do not know wether it is on purpose or not. + | + | + WARNING + false end def set_expected_number(relativity, count) 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 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec/rails/version.rb 2021-03-09 09:50:41.000000000 +0100 @@ -3,7 +3,7 @@ # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. - STRING = '4.0.2' + STRING = '5.0.0' end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rspec-rails.rb new/lib/rspec-rails.rb --- old/lib/rspec-rails.rb 2020-12-26 18:41:39.000000000 +0100 +++ new/lib/rspec-rails.rb 2021-03-09 09:50:41.000000000 +0100 @@ -7,13 +7,11 @@ # Railtie to hook into Rails. class Railtie < ::Rails::Railtie # As of Rails 5.1.0 you can register directories to work with `rake notes` - if ::Rails::VERSION::STRING >= '5.1' - require 'rails/source_annotation_extractor' - if ::Rails::VERSION::STRING >= '6.0' - ::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec") - else - SourceAnnotationExtractor::Annotation.register_directories("spec") - end + require 'rails/source_annotation_extractor' + if ::Rails::VERSION::STRING >= '6.0' + ::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec") + else + SourceAnnotationExtractor::Annotation.register_directories("spec") end generators = config.app_generators generators.integration_tool :rspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2020-12-26 18:41:39.000000000 +0100 +++ new/metadata 2021-03-09 09:50:41.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: rspec-rails version: !ruby/object:Gem::Version - version: 4.0.2 + version: 5.0.0 platform: ruby authors: - David Chelimsky @@ -44,7 +44,7 @@ ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ F3MdtaDehhjC -----END CERTIFICATE----- -date: 2020-12-26 00:00:00.000000000 Z +date: 2021-03-09 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: actionpack @@ -52,42 +52,42 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' - !ruby/object:Gem::Dependency name: railties requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.2' + version: '5.2' - !ruby/object:Gem::Dependency name: rspec-core requirement: !ruby/object:Gem::Requirement @@ -150,14 +150,14 @@ requirements: - - "~>" - !ruby/object:Gem::Version - version: 1.1.2 + version: 1.1.5 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: 1.1.2 + version: 1.1.5 - !ruby/object:Gem::Dependency name: aruba requirement: !ruby/object:Gem::Requirement @@ -296,7 +296,7 @@ - MIT metadata: bug_tracker_uri: https://github.com/rspec/rspec-rails/issues - changelog_uri: https://github.com/rspec/rspec-rails/blob/v4.0.2/Changelog.md + changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.0.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 +316,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.4 +rubygems_version: 3.2.4 signing_key: specification_version: 4 summary: RSpec for Rails Binary files old/metadata.gz.sig and new/metadata.gz.sig differ