Reputation: 21700
Let's say x
should be bigger than y
. How do I encode this in rspec?
Upvotes: 14
Views: 7977
Reputation: 1805
Using rspec 2.14 and the expectation syntax, this can be expressed like this:
expect(x).to be > y
Upvotes: 41
Reputation: 212
There are another ways to match inequalities:
x.should be_greater_than_or_equal_to(y)
x.should be_less_than_or_equal_to(y)
x.should be_greater_than(y)
x.should be_less_than(y)
Upvotes: 4
Reputation: 16355
Don't have RSpec on hand right now to verify, but I think this ought to work:
x.should > y
Upvotes: 7
Reputation:
wont this work for you?
x.should be > y
you could also try a more intuitive testing framework - Specular
then you can:
is?(x) > y
expect(x) > y
check(x) > y
etc.
Upvotes: 1