存根和rspec旧语法的问题
我正在编写一些代码并使用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
错误消息如下:使用来自rspec-mocks’old的stub
:should
不使用显式启用语法的语法。 使用new :expect
语法或显式启用:should
改为。