2012-11-27 39 views

回答

7

不必RSpec的手,現在來驗證,但我認爲這應該上班:

x.should > y 
+4

'should'在最近的版本中被棄用,使用'expect(x).to be> y' – Micah

1

這不適合你嗎?

x.should be > y 

,你也可以嘗試一個更直觀的測試框架 - Specular

那麼你可以:

is?(x) > y 
expect(x) > y 
check(x) > y 
etc. 
+0

如果它不支持表測試比rspec的更好不感興趣。 – Reactormonk

+0

對不起?桌面測試?我走出軌道? – 2012-11-27 20:54:56

+0

您在框架中引入了一堆數據行,並執行每行預測。 – Reactormonk

4

還有另一種方法來匹配不等式:

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) 
39

使用RSpec的2.14和預期的語法,這可以這樣表示:

expect(x).to be > y