Changelog.md
Released to relax version constraint for rspec to allow 4.0.0.beta1.
Bug Fixes:
lookup_context. (Stephen Nelson, #2749)rails stats looks for specs using application root rather than working directory.
(Marvin Tangpos, #2879)Bug Fixes:
Bug Fixes:
have_been_performed / have_been_enqueued return false for
supports_block_expectations? as they don't supporting block expectations.
(Sam Kidman, rspec/rspec-rails#2851)Enhancements:
ActiveRecord::Migration.maintain_test_schema!
(rspec/rspec-rails#2832)served_by in system specs. (Sam Giffney, rspec/rspec-rails#2841)Breaking Changes:
Bug Fixes:
have_enqueued_job et al (Jon Rowe, rspec/rspec-rails#2823)Enhancements:
have_broadcasted_to /
have_broadcast. (Simon Fish, rspec/rspec-rails#2795)infer_spec_type_from_file_location! in newly generated
rails_helper.rb files. (Jon Rowe, rspec/rspec-rails#2804)Bug Fixes:
have_enqueued_mail when jobs were incorrectly matched due
to refactoring in rspec/rspec-rails#2780. (David Runger, rspec/rspec-rails#2793)Bug Fixes:
Enhancements:
at_priority qualifier to have_enqueued_job set of matchers. (mbajur, rspec/rspec-rails#2759)rails stats on Rails main / 8.0.0. (Petrik de Heus, rspec/rspec-rails#2781)Bug Fixes:
rake spec:statsetup on Rails main / 8.0.0. (Petrik de Heus, rspec/rspec-rails#2781)Bug Fixes:
have_http_status matcher raising an error when encountering a raw Rack::MockResponse.
(Christophe Bliard, rspec/rspec-rails#2771)Bug Fixes:
ActiveSupport::CurrentAttributes between examples. (Javier Julio, rspec/rspec-rails#2752)have_status_code behaviour with deprecated status names by delegating
to Rack::Utils.status_code/1 to set the expected status code. (Darren Boyd, rspec/rspec-rails#2765)Bug Fixes:
Bug Fixes:
RSpec::Rails::Configuration.fixture_paths
(Benoit Tigeot, rspec/rspec-rails#2720)Enhancements:
rails_helper.rb to use Rails.root.join.
(@masato-bkn, Ryo Nakamura, rspec/rspec-rails#2640, rspec/rspec-rails#2678)RSpec::Rails::Configuration.fixture_paths configuration to support
the matching change to ActiveRecord::TestFixtures, previous singular
form is deprecated and will be removed in Rails 7.2. (Juan Gueçaimburu, rspec/rspec-rails#2673)send_email matcher to match emails rather than specific jobs.
(Andrei Kaleshka, rspec/rspec-rails#2670)render in view specs, :locals will now be merged into the
default implicit template, allowing render locals: {...} style calls.
(Jon Rowe, rspec/rspec-rails#2686)Rails.config.action_mailer.preview_paths on Rails 7.1/
(Jon Rowe, rspec/rspec-rails#2706)Bug Fixes:
have_broadcasted_to so that argument matchers can be used.
(Timothy Peraza, rspec/rspec-rails#2684):context hooks on Rails main. (Jon Rowe, rspec/rspec-rails#2685)stub_template on Rails main. (Jon Rowe, rspec/rspec-rails#2685)take_failed_screenshot producing an additional error through metadata
access. (Jon Rowe, rspec/rspec-rails#2704)ActiveSupport::ExecutionContext::TestHelper on Rails 7+. (Jon Rowe, rspec/rspec-rails#2711)stub_template on Rails 7.1. (Jon Rowe, rspec/rspec-rails#2714)Bug Fixes:
ActiveStorage::FixtureSet.file_fixture_path when including file fixture support.
(Jason Yates, rspec/rspec-rails#2671)broadcast_to matcher to take Symbols. (@Vagab, rspec/rspec-rails#2680)Bug Fixes:
render_views is off for Rails 7.1.
(Eugene Kenny, Iliana, rspec/rspec-rails#2631)#fixtures_paths in example groups (removes a deprecation warning).
(Nicholas Simmons, rspec/rspec-rails#2664)have_enqueued_job to properly detect enqueued jobs when other jobs were
performed inside the expectation block. (Slava Kardakov, Phil Pirozhkov, rspec/rspec-rails#2573)Bug Fixes:
#name. (Jon Rowe, rspec/rspec-rails#2625)Enhancements:
Breaking Changes:
after_teardown from after to around in system
specs to improve compatibility with extensions and Capybara. (Tim Diggins, rspec/rspec-rails#2596)Deprecations:
rspec:integration)
which was an alias of request spec generator (rspec:request)
(Luka Lüdicke, rspec/rspec-rails#2374)Bug Fixes:
Bug Fixes:
have_enqueued_mail.
(Jon Rowe, rspec/rspec-rails#2578)Enhancements:
rails_helper.rb template to use require_relative.
(Jon Dufresne, rspec/rspec-rails#2528)Bug Fixes:
--model-name parameter. (@kenzo-tanaka, rspec/rspec-rails#2534)have_enqueued_mail compatibility (Mikael Henriksson, rspec/rspec-rails#2537, rspec/rspec-rails#2546)Bug Fixes:
_job in filenames.
(Nick Flückiger, rspec/rspec-rails#2496)ActiveRecord::TestFixture#uses_transaction by using example description
to replace example name rather than example in our monkey patched
run_in_transaction? method. (Stan Lo, rspec/rspec-rails#2495)Bug Fixes:
Enhancements:
Breaking Changes:
Bug Fixes:
Enhancements:
#at mismatch on usec precision.
(Jon Rowe, rspec/rspec-rails#2350)_spec suffix instead of request_spec.
(Eloy Espinaco, Luka Lüdicke, rspec/rspec-rails#2355, rspec/rspec-rails#2356, rspec/rspec-rails#2378)let(:name) for Rails 6.1 and let(:method_name) on older
Rails. (Benoit Tigeot, rspec/rspec-rails#2461)Bug Fixes:
true/false from predicate methods in config rather than raw values.
(Phil Pirozhkov, Jon Rowe, rspec/rspec-rails#2353, rspec/rspec-rails#2354)use_active_record is false (Phil Pirozhkov, rspec/rspec-rails#2423)Bug Fixes:
driven_by in system specs. (Aubin Lorieux, rspec/rspec-rails#2302)#at in job matchers. (Jon Rowe, Markus Doits, rspec/rspec-rails#2304)have_enqueued_mail to match when a sub class of ActionMailer::DeliveryJob
is set using <Class>.delivery_job=. (Atsushi Yoshida rspec/rspec-rails#2305)required_ruby_version to gem spec. (Marc-André Lafortune, rspec/rspec-rails#2319, rspec/rspec-rails#2338)Enhancements:
have_enqueued_mail
(Ignatius Reza, rspec/rspec-rails#2118, rspec/rspec-rails#2125)have_enqueued_job (@alpaca-tc, rspec/rspec-rails#2157)have_enqueued_* matchers. (Phil Pirozhkov, rspec/rspec-rails#2206)have_been_performed/have_performed_job/perform_job ActiveJob
matchers (Isaac Seymour, rspec/rspec-rails#1785)ActiveJob matchers #on_queue modifier to take symbolic queue names. (Nils Sommer, rspec/rspec-rails#2283)ActionDispatch::SystemTesting::Server.silence_puma = true when running system specs.
(ta1kt0me, Benoit Tigeot, rspec/rspec-rails#2289)Bug Fixes:
EmptyTemplateHandler.call now needs to support an additional argument in
Rails 6. (Pavel Rosický, rspec/rspec-rails#2089)SQLite3Adapter.represent_boolean_as_integer which is
deprecated. (Pavel Rosický, rspec/rspec-rails#2092)ActionView::Template#formats has been deprecated and replaced by
ActionView::Template#format(Seb Jacobs, rspec/rspec-rails#2100)before_teardown as well as after_teardown to ensure screenshots
are generated correctly. (Jon Rowe, rspec/rspec-rails#2164)ActionView::FixtureResolver#hash has been renamed to ActionView::FixtureResolver#data.
(Penelope Phippen, rspec/rspec-rails#2076)driven_by(:selenium) being called due to hook precedence.
(Takumi Shotoku, rspec/rspec-rails#2188)WrongScopeError being thrown during loading fixtures on Rails
6.1 development version. (Edouard Chin, rspec/rspec-rails#2215)should. (Phil Pirozhkov, rspec/rspec-rails#2256)default_url_options in feature
specs, prevents a NoMethodError in some scenarios. (Eugene Kenny, rspec/rspec-rails#2277)ActiveJob::Base.queue_adapter inside a system spec.
(Jonathan Rochkind, rspec/rspec-rails#2242)rails generate generator command now creates related spec file (Joel Azemar, rspec/rspec-rails#2217)capybara version constraint to allow for Capybara 3.x (Phil Pirozhkov, rspec/rspec-rails#2281)Breaking Changes:
Bug Fixes:
Enhancements
__dir__ instead of __FILE__ in generated rails_helper.rb where
supported. (OKURA Masafumi, rspec/rspec-rails#2048)have_enqueued_mail matcher as a "super" matcher to the ActiveJob matchers
making it easier to match on ActiveJob delivered emails. (Joel Lubrano, rspec/rspec-rails#2047)Bug Fixes:
ActiveJob matchers fail when multiple jobs are queued for negated
matches. e.g. expect { job; job; }.to_not have_enqueued_job.
(Emric Istanful, rspec/rspec-rails#2069)Bug Fixes:
/ separated path rather than an _.
(@nxlith, rspec/rspec-rails#2077)errors before attempting to use it to generate the be_valid
error message. (Kevin Kuchta, rspec/rspec-rails#2096)Bug Fixes:
Mailer would be duplicated
in the name. (Kohei Sugi, rspec/rspec-rails#2037)ActiveJob matchers fail when multiple jobs are queued
for negated matches. e.g. `expect { job; job; }.to_not have_enqueued_job
(Emric Istanful, rspec/rspec-rails#2069)Bug Fixes:
NoMethodError: undefined method 'strip' when using a Pathname object
as the fixture file path. (Aaron Kromer, rspec/rspec-rails#2026)ActiveJob::DeserializationError from being issued when ActiveJob
matchers de-serialize arguments. (@aymeric-ledorze, rspec/rspec-rails#2036)Enhancements:
rails_helper.rb
(Koichi ITO, rspec/rspec-rails#1924)have_http_status matcher now supports Rails 5.2 style response symbols
(Douglas Lovell, rspec/rspec-rails#1951)ActionView::Template used in stub_template resulting
in increased performance due to less allocations and setup. (Simon Coffey, rspec/rspec-rails#1979)Bug Fixes:
fixture_path is not set.
(Laurent Cobos, rspec/rspec-rails#1943)Bug Fixes:
Bug Fixes:
Bug Fixes:
Enhancements:
be_a_new(...).with(...) matcher to accept matchers for
attribute values. (Britni Alexander, rspec/rspec-rails#1811)ActionDispatch::SystemTestCase. (Sam Phippen, rspec/rspec-rails#1813)Enhancements:
Bug Fixes:
Enhancements:
spec_helper.rb earlier in rails_helper.rb by default.
(Kevin Glowacz, rspec/rspec-rails#1795)Enhancements:
rake notes in Rails >= 5.1. (John Meehan, rspec/rspec-rails#1661)assigns and assert_template from scaffold spec generators (Josh
Justice, rspec/rspec-rails#1689)Bug Fixes:
rspec/core from rspec/rails to avoid
IRB context warning. (Myron Marston, rspec/rspec-rails#1678)Bug Fixes:
ActionDispatch::IntegrationTest::Behavior on Rails 5,
and above; Prevents possible TypeError when an existing Behaviour class
is defined. (#1660, Betesh).No user facing changes since beta4
Enhancements:
with on have_enqueued_job. (John Schroeder, rspec/rspec-rails#1578)file_fixture(...). (Wojciech Wnętrzak, rspec/rspec-rails#1587)setup and teardown with blocks (Miklós Fazekas, rspec/rspec-rails#1598)enqueue_job alias for have_enqueued_job, support once/twice/
thrice, add have_been_enqueued matcher to support use without blocks.
(Sergey Alexandrovich, rspec/rspec-rails#1613)Bug fixes:
NoMethodError during failed have_rendered assertions on weird templates.
(Jon Rowe, rspec/rspec-rails#1623).Enhancements:
Bug fixes:
Enhancements:
ActionDispatch::IntegrationTest::Behavior in request spec
example groups when on Rails 5, allowing integration test helpers
to be used in request specs. (Scott Bronson, rspec/rspec-rails#1560)Bug fixes:
Enhancements:
--singularize option for the feature spec generator (Felicity McCabe,
rspec/rspec-rails#1503)Bug fixes:
before(:context) block, instead of
crashing with a undefined method for nil:NilClass. (Sam Phippen, rspec/rspec-rails#1501)have_enqueued_job is used with non-test
adapter. (Wojciech Wnętrzak, rspec/rspec-rails#1489)Bug Fixes:
Bug Fixes:
:file
parameters for Rails version 4.2.5.1. (Andrew White, Sam Phippen, rspec/rspec-rails#1535)Enhancements:
have_rendered matcher on a redirect
response. (Alex Egan, rspec/rspec-rails#1440)have_enqueued_job matcher for checking if a block has queued jobs.
(Wojciech Wnętrzak, rspec/rspec-rails#1464)Bug Fixes:
fixture_path error
when loading rspec-rails after a spec has been created. (Nikki Murray, rspec/rspec-rails#1430)lib code. (Jam Black, rspec/rspec-rails#1439)Bug Fixes:
Rails.configuration.hidden_namespaces
including symbols. (Dan Kohn, rspec/rspec-rails#1414)Bug Fixes:
define_attribute_methods on the
abstract AR class. (Jon Rowe, rspec/rspec-rails#1396)Bug Fixes:
Enhancements:
routes by using yield
instead of call. (Anton Davydov, rspec/rspec-rails#1308)ActiveJob specs as standard RSpec::Rails::RailsExampleGroups
via both type: :job and inferring type from spec directory spec/jobs.
(Gabe Martin-Dempesy, rspec/rspec-rails#1361)RSpec::Rails::FixtureSupport into example groups using metadata
use_fixtures: true. (Aaron Kromer, rspec/rspec-rails#1372)rspec:request generator for generating request specs; this is an
alias of rspec:integration (Aaron Kromer, rspec/rspec-rails#1378)rails_helper generator with a default check to abort the spec run
when the Rails environment is production. (Aaron Kromer, rspec/rspec-rails#1383)Bug Fixes:
preview_path=
on Rails 3.x and 4.0 (Aaron Kromer, rspec/rspec-rails#1388)Bug Fixes:
Helper object for view specs sitting in the
app/views root (David Daniell, rspec/rspec-rails#1289)need_auto_run= error when using Ruby 2.1 and Rails 3.2
without the test-unit gem (Orien Madgwick, rspec/rspec-rails#1350)fixture_path error
when loading rspec-rails after a spec has been created. (Aaron Kromer, rspec/rspec-rails#1372)Bug Fixes:
require to RSpec generator root fixing an issue where Rail's
autoload does not find it in some environments. (Aaron Kromer, rspec/rspec-rails#1305)be_routable matcher now has the correct description. (Tony Ta, rspec/rspec-rails#1310)test-unit gem's autorunner on projects running Rails < 4.1 and
Ruby < 2.2 (Aaron Kromer, rspec/rspec-rails#1320)Enhancements:
ActionMailer mailer previews (Takashi Nakagawa, rspec/rspec-rails#1185)ActionMailer preview path via a Railtie (Aaron Kromer, rspec/rspec-rails#1236)rails generate (Eliot Sykes, rspec/rspec-rails#1248)instance_double to support verifying dynamic column methods defined
by ActiveRecord (Jon Rowe, rspec/rspec-rails#1238)type tags in the spec
generators on Rails 4. (Michael Stock, rspec/rspec-rails#1292)Bug Fixes:
rspec:feature generator to use RSpec namespace preventing errors when
monkey-patching is disabled. (Rebecca Skinner, rspec/rspec-rails#1231)NoMethodError caused by calling RSpec.feature when Capybara is not
available or the Capybara version is < 2.4.0. (Aaron Kromer, rspec/rspec-rails#1261)ArgumentError when using an anonymous controller which inherits an
outer group's anonymous controller. (Yuji Nakayama, rspec/rspec-rails#1260)Test class
in Rails 4.1 and 4.2. (Aaron Kromer, rspec/rspec-rails#1295)Enhancements:
have_http_status matcher in spec generators. (Aaron Kromer, rspec/rspec-rails#1086)rails_helper generator to allow users to opt-in to auto-loading
spec/support files instead of forcing it upon them. (Aaron Kromer, rspec/rspec-rails#1137)ActiveJob. (Abdelkader Boudih, rspec/rspec-rails#1155)rails_helper. (Aaron Kromer, rspec/rspec-rails#1150)#method syntax in all generated controller specs. (Griffin Smith, rspec/rspec-rails#1206)Bug Fixes:
Bug Fixes:
SetupAndTeardownAdapter. (André Arko, rspec/rspec-rails#1085)Bug Fixes:
rails g rspec:install. (Sam Phippen, rspec/rspec-rails#1058)Enhancements:
spec_helper from Rails setup
and associated configuration options. Moving Rails specific settings and
options to rails_helper. (Aaron Kromer)Bug Fixes:
ActiveRecord isn't loaded. (Jon Rowe)Breaking Changes for 3.0.0:
mock_model and stub_model methods to the
rspec-activemodel-mocks gem. (Thomas Holmes)config.infer_spec_type_from_file_location!, which is still supplied
in the default generated spec_helper.rb. (Xavier Shay, Myron Marston)controller macro in controller specs no longer mutates
:described_class metadata. It still overrides the subject and sets
the controller, though. (Myron Marston)rspec-collection_matchers. Users who
want those matchers should add the gem to their Gemfile and require it
themselves. (Myron Marston)ActiveModel. (Rodrigo Rosenfeld Rosas)Enhancements:
have_http_status matcher. (Aaron Kromer)Bug Fixes:
config.before(:all, type: <type>) hooks run before groups
of the given type, even when the type is inferred by the file
location. (Jon Rowe, Myron Marston)Rack::Utils::parse_nested_query to match Rails.
(Tim Watson)Breaking Changes for 3.0.0:
--webrat option for the request spec generator (Andy Lindeman)Capybara::DSL (e.g., visit) are no longer available in
controller specs. It is more appropriate to use capybara in feature specs
(spec/features) instead. (Andy Lindeman)infer_base_class_for_anonymous_controllers is
enabled by default. (Thomas Holmes)Enhancements:
be_valid matcher for non-ActiveModel::Errors implementations (Ben Hamill)Bug Fixes:
__send__ rather than send to prevent naming collisions (Bradley Schaefer)ActionController::Base if ApplicationController
is not present. (Jon Rowe)rspec/collection_matchers when rspec/rails is required. (Yuji Nakayama)Breaking Changes for 3.0.0:
autotest and autotest-rails support to rspec-autotest gem.
(Andy Lindeman)No changes. Just taking it out of pre-release.
Deprecations
stub_model and mock_model in favor of the
rspec-activemodel-mocks gem. (Thomas Holmes)config.infer_spec_type_from_file_location! during the
upgrade process since spec type inference is opt-in in 3.0.
(Jon Rowe)described_class is accessed in a controller
example group that has used the controller { } macro to generate an
anonymous controller class, since in 2.x, described_class would
return that generated class but in 3.0 it will continue returning the
class passed to describe. (Myron Marston)Deprecations:
--webrat option to the scaffold and request spec generator (Andy Lindeman)Capybara::DSL (e.g., visit) in controller specs.
It is more appropriate to use capybara in feature specs (spec/features)
instead. (Andy Lindeman)Bug Fixes:
__send__ rather than send to prevent naming collisions (Bradley Schaefer)ActionController::Base if ApplicationController
is not present. (Jon Rowe)Deprecations:
rspec-autotest gem. (Andy
Lindeman)Enhancements:
Bug Fixes:
--warnings are enabled. (Andy Lindeman)activemodel. This allows libraries that do not bring
in all of rails to use rspec-rails. (John Firebaugh)Bug Fixes:
--warnings are enabled. (Andy Lindeman)activemodel. This allows libraries that do not bring
in all of rails to use rspec-rails. (John Firebaugh)__send__ rather than send to prevent naming collisions (Bradley Schaefer)Bug fixes
let definitions in controller specs after the
issue was fixed upstream in rspec-core. (Andy Lindeman)expect(Model).to have(n).records with
Rails 4. (Andy Lindeman)Enhancements
Bug fixes
rake stats runs correctly when spec files exist at the top level of the
spec/ directory. (Benjamin Fleischer)Bug fixes
let definitions may override methods defined in modules brought in via
config.include in controller specs. Fixes regression introduced in 2.13.
(Andy Lindeman, Jon Rowe)Enhancements
Bug fixes
ActionController::Base.allow_forgery_protection is set to its original
value after each example. (Mark Dimas)patch is supported in routing specs. (Chris Your)Enhancements
be_valid matcher includes validation error messages. (Tom Scott)spec_helper.rb in Rails 4 includes a check for pending
migrations. (Andy Lindeman)rake spec:features task. (itzki)Bug fixes
_routes method
to support testing of redirection and generation of URLs from other contexts.
The implementation ended up breaking the ability to refer to non-anonymous
routes in the context of the controller under test.assert_select correctly in view specs generated by scaffolding. (Andy
Lindeman)Bug fixes
expect(subject).to have(...).errors_on operates correctly for
ActiveResource models where valid? does not accept an argument. (Yi Wen)ActiveRecord::Relation and the =~ operator matcher.
(Andy Lindeman)_routes to support testing of redirection
and generation of URLs from other contexts. (Andy Lindeman)Enhancements
#errors_on (Woody Peterson)Bug fixes
should and should_not to CollectionProxy (Rails 3.1+) and
AssociationProxy (Rails 3.0). (Myron Marston)controller.controller_path is set correctly for view specs in Rails 3.1+.
(Andy Lindeman)render properly infers the view to be rendered in Rails 3.0 and 3.1
(John Firebaugh)be_new_record are more useful (Andy Lindeman)Capybara-2.0 integration support:
See https://github.com/jnicklas/capybara/pull/809 and https://rubydoc.info/gems/rspec-rails/file/Capybara.md for background.
2.11.1, .2, .3 were yanked due to errant documentation.
Enhancements
spec/spec_helper.rb sets config.order = "random" so that
specs run in random order by default.render_template to have_rendered (and alias to render_template
for backward compatibility)rails generate scaffold namespaced::model
matches the spec generated with rails generate scaffold namespaced/model
(Kohei Hasegawa)Bug fixes
rspec-rails-uncommitted that define Rspec::Rails before rspec-rails
loads (Andy Lindeman)Bug fixes
Bug fixes
render_views called in a spec can now override the config setting. (martinsvalin)render_views for anonymous controllers on 1.8.7. (hudge, mudge)process_view_pathsroute_to matcher with should_notcontroller is no longer nil in config.before hooksrequest.path_parameters keys to symbols to match real Rails
environment (Nathan Broadbent)Enhancements
Bug fixes
mock_model(XXX).as_null_object.unknown_method returns self againNOTE: there was a change in rails-3.2.0.rc2 which broke compatibility with stub_model in rspec-rails. This release fixes that issue, but it means that you'll have to upgrade to rspec-rails-2.8.1 when you upgrade to rails >= 3.2.0.rc2.
= 3.2.0.rc2.
Enhancements
Bug fixes
respond_to? call on mocked model (Igor
Afonov)Enhancements
Changes
Enhancements
ActiveRecord::Relation can use the =~ matcher (Andy Lindeman)require 'rspec/autorun' from generated spec_helper.rb (David Chelimsky)bypass_rescue (Lenny Marks)route_to accepts query string (Marc Weil)Internal
Bug fixes
fixure_file_upload reads from ActiveSupport::TestCase.fixture_path and
misses RSpec's configuration (David Chelimsky)primary_key on class generated by mock_model("WithAString")
(David Chelimsky)This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
Enhancements
mock_model without requiring the whole
rails frameworkany_instance to avoid stubbing findersmock_model[append|prepend]_view_paths with empty templates
unless rendering views. (Mark Turner)Bug fixes
Enhancements
Bug fixes
render_views in a nested group set the value in its
parent group.Enhancements
Bug fixes
Deprecations
Bug fixes
Deprecations
Enhancements
Bug fixes
Enhancements
Bug fixes
Enhancements
Bug fixes
Enhancements
Bug fixes