diff --git a/Changelog.md b/Changelog.md index 90c2515d9b..a5b45a06eb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ -### Development -[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.9.0...master) +### 3.9.1 / 2020-03-10 +[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.9.0...v3.9.1) + +Bug Fixes: + +* Add missing require for have_enqueued_mail matcher. (Ignatius Reza, #2117) ### 3.9.0 / 2019-10-08 [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.8.2...v3.9.0) diff --git a/Gemfile b/Gemfile index 03852dce93..89036e90a9 100644 --- a/Gemfile +++ b/Gemfile @@ -7,12 +7,12 @@ gemspec rspec_dependencies_gemfile = File.expand_path("../Gemfile-rspec-dependencies", __FILE__) eval_gemfile rspec_dependencies_gemfile -gem 'yard', '~> 0.8.7', :require => false +gem 'yard', '~> 0.9.24', :require => false ### deps for rdoc.info group :documentation do - gem 'redcarpet', '2.3.0' - gem 'github-markup', '1.0.0' + gem 'redcarpet' + gem 'github-markup' if RUBY_VERSION > '2.0.0' gem 'relish' end diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index a849eeeda4..9d9bd20849 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -1,4 +1,10 @@ version_file = File.expand_path("../.rails-version", __FILE__) + +# FIXME: rack 2.1.0 introduces a deprecation warning that rails is triggering, +# but in later versions this warning will be removed. Get rid of this hack once +# rack 2.1.0+ is out. +gem 'rack', '!= 2.1.0' + case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || '' when /master/ gem "rails", :git => "https://github.com/rails/rails.git" @@ -43,6 +49,16 @@ else if version >= '5-1-stable' && RUBY_VERSION >= "2.2" gem "puma" end + + if RUBY_VERSION < "2.5" + gem "sprockets", "~> 3.0" + end + + if version.gsub(/[^\d\.]/,'').to_f >= 6.0 + gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", :platforms => [:jruby] + else + gem 'activerecord-jdbcsqlite3-adapter', :platforms => [:jruby] + end end gem "i18n", '< 0.7.0' if RUBY_VERSION < '1.9.3' diff --git a/README.md b/README.md index 0484f8cda2..bb8726e71a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x. ```ruby # Run against the latest stable release group :development, :test do - gem 'rspec-rails', '~> 3.8' + gem 'rspec-rails', '~> 3.9' end # Or, run against the master branch diff --git a/appveyor.yml b/appveyor.yml index b2fac867df..68756416f9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. version: "{build}" diff --git a/example_app_generator/spec/verify_mailer_preview_path_spec.rb b/example_app_generator/spec/verify_mailer_preview_path_spec.rb index a2b48b01c0..b6217dacf5 100644 --- a/example_app_generator/spec/verify_mailer_preview_path_spec.rb +++ b/example_app_generator/spec/verify_mailer_preview_path_spec.rb @@ -25,6 +25,7 @@ def capture_exec(*ops) # Necessary to ignore warnings from Rails code base out = io.readlines. reject { |line| line =~ /warning: circular argument reference/ }. + reject { |line| line =~ /Gem::Specification#rubyforge_project=/ }. join. chomp CaptureExec.new(out, $?.exitstatus) diff --git a/features/job_specs/job_spec.feature b/features/job_specs/job_spec.feature index 00850f7fb3..d195893a82 100644 --- a/features/job_specs/job_spec.feature +++ b/features/job_specs/job_spec.feature @@ -1,11 +1,8 @@ Feature: job spec - Job specs provide alternative assertions to those available in - `ActiveJob::TestHelper` and help assert behaviour of the jobs themselves - and that other entities correctly enqueue them. + Job specs provide alternative assertions to those available in `ActiveJob::TestHelper` and help assert behaviour of the jobs themselves and that other entities correctly enqueue them. - Job specs are marked by `:type => :job` or if you have set - `config.infer_spec_type_from_file_location!` by placing them in `spec/jobs`. + Job specs are marked by `:type => :job` or if you have set `config.infer_spec_type_from_file_location!` by placing them in `spec/jobs`. With job specs, you can: @@ -14,10 +11,7 @@ Feature: job spec * specify when the job was enqueued until * specify the queue which the job was enqueued to - Check the documentation on - [`have_been_enqueued`](matchers/have-been-enqueued-matcher) and - [`have_enqueued_job`](matchers/have-enqueued-job-matcher) for more - information. + Check the documentation on [`have_been_enqueued`](../matchers/have-been-enqueued-matcher), [`have_enqueued_job`](../matchers/have-enqueued-job-matcher) for more information. Background: Given active job is available diff --git a/features/support/env.rb b/features/support/env.rb index a79a4e1b4f..d4d96ebb81 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -2,23 +2,41 @@ require 'fileutils' module ArubaExt - def run(cmd, timeout = nil) + def run_command(cmd, timeout = nil) exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd - super(exec_cmd, timeout) + unset_bundler_env_vars + # Ensure the correct Gemfile and binstubs are found + in_current_directory do + with_unbundled_env do + super(exec_cmd, timeout) + end + end end - # This method over rides Aruba 0.5.4 implementation so that we can reset Bundler to use the sample app Gemfile - def in_current_dir(&block) - Bundler.with_clean_env do - _mkdir(current_dir) - Dir.chdir(current_dir, &block) + + def unset_bundler_env_vars + empty_env = with_environment { with_unbundled_env { ENV.to_h } } + aruba_env = aruba.environment.to_h + (aruba_env.keys - empty_env.keys).each do |key| + delete_environment_variable key + end + empty_env.each do |k, v| + set_environment_variable k, v + end + end + + def with_unbundled_env + if Bundler.respond_to?(:with_unbundled_env) + Bundler.with_unbundled_env { yield } + else + Bundler.with_clean_env { yield } end end end World(ArubaExt) -Before do - @aruba_timeout_seconds = 30 +Aruba.configure do |config| + config.exit_timeout = 30 end unless File.directory?('./tmp/example_app') diff --git a/lib/rspec/rails/matchers.rb b/lib/rspec/rails/matchers.rb index dd37321e80..1602654af3 100644 --- a/lib/rspec/rails/matchers.rb +++ b/lib/rspec/rails/matchers.rb @@ -22,4 +22,5 @@ module Matchers require 'rspec/rails/matchers/have_http_status' if RSpec::Rails::FeatureCheck.has_active_job? require 'rspec/rails/matchers/active_job' + require 'rspec/rails/matchers/have_enqueued_mail' end diff --git a/lib/rspec/rails/version.rb b/lib/rspec/rails/version.rb index f93a1ab82e..282e11a0b9 100644 --- a/lib/rspec/rails/version.rb +++ b/lib/rspec/rails/version.rb @@ -3,7 +3,7 @@ module Rails # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. - STRING = '3.9.0' + STRING = '3.9.1' end end end diff --git a/rspec-rails.gemspec b/rspec-rails.gemspec index 8086d7818e..d9ef49b90a 100644 --- a/rspec-rails.gemspec +++ b/rspec-rails.gemspec @@ -51,6 +51,6 @@ Gem::Specification.new do |s| end s.add_development_dependency 'cucumber', '~> 1.3.5' - s.add_development_dependency 'aruba', '~> 0.5.4' + s.add_development_dependency 'aruba', '~> 0.14.12' s.add_development_dependency 'ammeter', '~> 1.1.2' end diff --git a/script/after_update_travis_build.sh b/script/after_update_travis_build.sh index 61b7bc5486..b2171dfaa4 100755 --- a/script/after_update_travis_build.sh +++ b/script/after_update_travis_build.sh @@ -3,3 +3,6 @@ set -e echo "Restoring custom Travis config" mv .travis.yml{.update_backup,} + +echo "Removing Base rubocop, Rspec-Rails does not use it" +rm '.rubocop_rspec_base.yml' diff --git a/script/clone_all_rspec_repos b/script/clone_all_rspec_repos index 70b9e0a4e7..64f4ee8f5d 100755 --- a/script/clone_all_rspec_repos +++ b/script/clone_all_rspec_repos @@ -1,5 +1,5 @@ #!/bin/bash -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. set -e diff --git a/script/downgrade_bundler_on_old_rails b/script/downgrade_bundler_on_old_rails index c86d3762f1..ae59f78626 100755 --- a/script/downgrade_bundler_on_old_rails +++ b/script/downgrade_bundler_on_old_rails @@ -12,7 +12,7 @@ if ruby -e "exit(ENV['RAILS_VERSION'].scan(/\d+\.\d+.\d+/)[0].to_f < 5)"; then gem uninstall -aIx bundler || echo "Warning error occured removing bundler via gem" # this only works on Ruby 2.3 which is luckily the version we need to fix - if is_ruby_23; then + if ruby -e "exit(RUBY_VERSION.to_f == 2.3)"; then rvm @global do gem uninstall -aIx bundler fi diff --git a/script/functions.sh b/script/functions.sh index 32b2d66a8f..ba9305efba 100644 --- a/script/functions.sh +++ b/script/functions.sh @@ -1,4 +1,4 @@ -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -6,7 +6,7 @@ source $SCRIPT_DIR/travis_functions.sh source $SCRIPT_DIR/predicate_functions.sh # If JRUBY_OPTS isn't set, use these. -# see http://docs.travis-ci.com/user/ci-environment/ +# see https://docs.travis-ci.com/user/ci-environment/ export JRUBY_OPTS=${JRUBY_OPTS:-"--server -Xcompile.invokedynamic=false"} SPECS_HAVE_RUN_FILE=specs.out MAINTENANCE_BRANCH=`cat maintenance-branch` @@ -187,7 +187,9 @@ function run_all_spec_suites { fold "rspec-core specs" run_spec_suite_for "rspec-core" fold "rspec-expectations specs" run_spec_suite_for "rspec-expectations" fold "rspec-mocks specs" run_spec_suite_for "rspec-mocks" - fold "rspec-rails specs" run_spec_suite_for "rspec-rails" + if rspec_rails_compatible; then + fold "rspec-rails specs" run_spec_suite_for "rspec-rails" + fi if rspec_support_compatible; then fold "rspec-support specs" run_spec_suite_for "rspec-support" diff --git a/script/predicate_functions.sh b/script/predicate_functions.sh index e2f4ac24cc..9b8616145a 100644 --- a/script/predicate_functions.sh +++ b/script/predicate_functions.sh @@ -1,4 +1,4 @@ -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. function is_mri { @@ -69,16 +69,16 @@ function is_mri_2plus { fi } -function is_ruby_23 { - if ruby -e "exit(RUBY_VERSION.to_f == 2.3)"; then +function is_ruby_23_plus { + if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then return 0 else return 1 fi } -function is_ruby_23_plus { - if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then +function rspec_rails_compatible { + if is_ruby_23_plus; then return 0 else return 1 diff --git a/script/run_build b/script/run_build index a4a5c3dc01..277e7f27d0 100755 --- a/script/run_build +++ b/script/run_build @@ -1,5 +1,5 @@ #!/bin/bash -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. set -e diff --git a/script/travis_functions.sh b/script/travis_functions.sh index 15cc10279f..4a86428a6b 100644 --- a/script/travis_functions.sh +++ b/script/travis_functions.sh @@ -1,4 +1,4 @@ -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. # Taken from: diff --git a/script/update_rubygems_and_install_bundler b/script/update_rubygems_and_install_bundler index 8dbe307dd5..a6b4a95925 100755 --- a/script/update_rubygems_and_install_bundler +++ b/script/update_rubygems_and_install_bundler @@ -1,13 +1,19 @@ #!/bin/bash -# This file was generated on 2019-07-24T15:33:53+02:00 from the rspec-dev repo. +# This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo. # DO NOT modify it by hand as your changes will get lost the next time it is generated. set -e source script/functions.sh if is_ruby_23_plus; then - gem update --system - gem install bundler + if ruby -e "exit(ENV['RAILS_VERSION'].scan(/\d+\.\d+.\d+/)[0].to_f >= 5)"; then + yes | gem update --system + yes | gem install bundler + else + echo "Warning installing older versions of Rubygems / Bundler" + gem update --system '2.7.8' + gem install bundler -v '1.17.3' + fi else echo "Warning installing older versions of Rubygems / Bundler" gem update --system '2.7.8' diff --git a/spec/sanity_check_spec.rb b/spec/sanity_check_spec.rb index cb32e406fb..c7aed44f6f 100644 --- a/spec/sanity_check_spec.rb +++ b/spec/sanity_check_spec.rb @@ -7,6 +7,14 @@ before{ FileUtils.mkdir_p tmp_root } + def with_clean_env + if Bundler.respond_to?(:with_unbundled_env) + Bundler.with_unbundled_env { yield } + else + Bundler.with_clean_env { yield } + end + end + it "fails when libraries are not required" do script = tmp_root.join("fail_sanity_check") File.open(script, "w") do |f| @@ -17,7 +25,7 @@ end FileUtils.chmod 0777, script - Bundler.with_clean_env do + with_clean_env do expect(`bundle exec #{script} 2>&1`). to match(/uninitialized constant RSpec::Support/). or match(/undefined method `require_rspec_core' for RSpec::Support:Module/) @@ -26,7 +34,7 @@ end end - it "passes when libraries are required" do + it "passes when libraries are required", :unless => RSpec::Support::Ruby.jruby? do script = tmp_root.join("pass_sanity_check") File.open(script, "w") do |f| f.write <<-EOF.gsub(/^\s+\|/, '') @@ -38,7 +46,7 @@ end FileUtils.chmod 0777, script - Bundler.with_clean_env do + with_clean_env do expect(`bundle exec #{script} 2>&1`).to be_empty expect($?.exitstatus).to eq(0) end