In RSpec - how can I test if one attribute is less (or more) than another In RSpec - how can I test if one attribute is less (or more) than another ruby ruby

In RSpec - how can I test if one attribute is less (or more) than another


It is generally recommended to use expect, not should.

For instance:

  expect(@car.date_from).to be <= @car.date_till

Resources:- BetterSpecs examples- Rspec Docs


Just use <=

date_from.should be <= date_till


Or in new syntax

expect(date_from).to be <= date_till