Ruby rspec-参数数目错误(0表示1..2)

Ruby rspec-参数数目错误(0表示1..2),ruby,rspec,Ruby,Rspec,鉴于此代码: class Game def self.game_board return [[][][]] end def self.empty_output '_|_|_'+ '_|_|_'+ ' | |' end end 这些测试: describe 'It should display a grid' do it 'should have empty output' do Game.empty_output.should ==

鉴于此代码:

class Game

  def self.game_board
    return [[][][]]
  end
  def self.empty_output
    '_|_|_'+
    '_|_|_'+
    ' | |'
  end
end
这些测试:

describe 'It should display a grid' do
  it 'should have empty output' do
    Game.empty_output.should ==
    '_|_|_'+
    '_|_|_'+
    ' | |'
  end
  it 'should have an empty array for the game ' do
    Game.game_board.should ==
    [[][][]]
  end
end
为什么尝试返回带有错误的数组数组的测试失败

.F

Failures:

  1) "It should display a grid should be empty
     Failure/Error: return [[][][]]
     ArgumentError:
       wrong number of arguments (0 for 1..2)
     # ./checkers_rspec.rb:4:in `[]'
     # ./checkers_rspec.rb:4:in `game_board'
     # ./checkers_rspec.rb:24:in `block (2 levels) in <top (required)>'

Finished in 0.00121 seconds
2 examples, 1 failure
.F
失败:
1) “应显示一个网格,该网格应为空
失败/错误:返回[]]
参数错误:
参数数目错误(0表示1..2)
#./checkers\u rspec.rb:4:in`[]'
#/跳棋规则rb:4:在“棋盘游戏”中
#./checkers_rspec.rb:24:in“块(2层)in”
在0.00121秒内完成
2例,1例失败

在语法上是否有效?是否应该读
[[]、[]、[]、[]]
?是否有人想尝试解释错误消息?;-)(在irb中键入
[[]
,以获得最简单的情况)
[[][][]] should hae been [[],[],[]] in both cases.