我遇到了一个失败的 github 规范,当我正在学习如何编写规范时,我修复了其中两个在最后一个中失败的问题,并附上评论#这个仍然失败。如何让它通过?
class Team
attr_reader :players
def initialize
@players = Players.new
end
end
class Players
def initialize
@players = ["","Some Player",""]
end
def size
@players.size
end
def include? player
raise "player must be a string" unless player.is_a?(String)
@players.include? player
end
end
describe "A new team" do
before(:each) do
@team = Team.new
end
it "should have 3 players (failing example)" do
@team.should have(3).players
end
it "should include some player (failing example)" do
@team.players.should include("Some Player")
end
#THIS ONE IS STILL FAILING
it "should include 5 (failing example)" do
@team.players.should include(5)
end
it "should have no players"
end