0

このコードを考えると:

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
4

1 に答える 1