我的rspec gem的IronRuby安裝似乎缺少自動化的be_ *方法助手。例如,下面的代碼生成一個未定義的方法錯誤:rspec w/IronRuby缺少be_ *方法
require 'rubygems'
require 'rspec'
x = 7
x.should == 7 # works
x.nonzero?.should == 7 #works
x.should be_nonzero # undefined method `be_nonzero' for main:Object
我用IGEM安裝rspec的寶石。這裏是我安裝的寶石列表:
bewildr (0.1.14)
builder (3.0.0)
cucumber (0.6.3)
diff-lcs (1.1.3)
iron-term-ansicolor (0.0.3)
json_pure (1.7.3)
polyglot (0.3.3)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.1)
rspec-mocks (2.11.1)
term-ansicolor (1.0.7)
treetop (1.4.10)
任何想法我在這裏失蹤?
嗯。你是對的 - 將代碼放入一個describe ... if ... block來解決這個問題。但是如果是這樣的話,當我想讓它們在一個塊之外時,我怎麼能夠引入這些匹配器 - 就像在一個黃瓜裏面當/^etc $/do塊一樣?或者我錯誤地認爲這個功能來自rspec? – 2012-07-23 17:36:15