我正在编写一些代码并使用 rspec,但收到警告说语法很旧,我无法弄清楚我应该如何编写它?
it "should calculate the value correctly" do
mock_cards = [Card.new(:clubs, 5), Card.new(:diamonds, 10)]
hand = Hand.new
hand.stub(:cards) { cards } #stub out cards and have it return cards
expect(hand.value).to eq (15)
end
错误消息如下: 不推荐使用stub
from rspec-mocks' old :should
syntax without显式启用该语法。改用新:expect
语法或显式启用:should
。