dimanche 27 décembre 2020

Rspec raise matcher not working, copied syntax from docs?

rspec-core (3.9.1)
rspec-expectations (3.9.0)
rspec-mocks (3.9.1)
rspec-rails (4.0.0.beta4, 3.9.0)
rspec-support (3.9.2)

According to docs: https://relishapp.com/rspec/rspec-expectations/v/3-9/docs/built-in-matchers/raise-error-matcher, this should work:

expect { raise StandardError }.to raise_error

Yet in my code, when I run JUST that spec by itself, I get:

Failures:

  1) time rules should work
     Failure/Error: expect(raise StandardError).to raise_error
     
     StandardError:
       StandardError
     # ./spec/models/time_rules_spec.rb:87:in `block (2 levels) in <top (required)>'

Aucun commentaire:

Enregistrer un commentaire