How to resolve RSpec failure warning about new wait syntax?

When I run this RSpec example, it passes, but I get a failure warning.

context "should have valid detail for signup" do
  it "should give error for invalid confirm password" do
    find("#usernamesignup").set("Any_name")
    find("#mobile_number").set("1234567890")
    find("#emailsignup").set("mymail@yopmail.com")
    find("#passwordsignup").set("12345678")
    find("#passwordsignup_confirm").set("")
    find(".signin").click
    sleep 2
    page.should have_content "Confirm Password Does not Match"
  end
end

Here is the result:

Resignation Alerts:

Using rspec-expectations shouldfrom the old syntax :shouldwithout explicitly allowing the syntax is deprecated. Use the new :expectsyntax or explicitly enable :shouldwith config.expect_with(:rspec) { |c| c.syntax = :should }. Called from / home / rails / rails _nimish / Devise_use / spec / features / users_spec.rb: 113: in `block (4 levels) in '

enter image description here

How to resolve this warning?

Update: solution I just replaced

page.should have_content "Password confirmation does not match"

from:

expect(page).to have_content "Confirm Password Does not Match"
+4
2

, :

  • RSpec, .should. ; .should , , . .should, , spec_helper.rb( rspec-mocks, , , ):

    RSpec.configure do |config|
      config.expect_with :rspec do |expectations|
        expectations.syntax = :should
      end
    end
    

    expect, .should,

    expectations.syntax = [:expect, :should]
    

    , .

  • expect(page).to have_content "Confirm Password Does not Match"
    

    , , transpec, .

: sleep 2 . Capybara have_content .

+2

:

page.should have_content " "

:

expect(page).to have_content "Confirm Password Does not Match"
+4

Source: https://habr.com/ru/post/1628632/


All Articles