How to resolve RSpec's deprecation warning about the new expect syntax?
As the message says you have two options:
Explicitly configure RSpec to allow
.should
. Don't use that option;.should
is deprecated and will likely not be as well supported in the future. If you really wanted to allow.should
, though, you could do it by adding this to your spec_helper.rb (or editing the example configuration of rspec-mocks that is probably already there):RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.syntax = :should end end
If you want to use both
expect
and.should
, setexpectations.syntax = [:expect, :should]
But don't do that, pick one and use it everywhere in your tests suite.
Rewrite your expectation to
expect(page).to have_content "Confirm Password Does not Match"
If you have many specs whose syntax needs upgrading, you can use the transpec gem to do it automatically.
Side note: Don't sleep 2
before your expectation. Capybara's have_content
matcher waits for you.
I just replaced:
page.should have_content "Confirm Password Does not Match"
with:
expect(page).to have_content "Confirm Password Does not Match"