I’ve tried setting the display method to self, but that doesn’t correct the right answer, and if I set it to Board.new, I get a new instance of the board, not the one that was created in the game class. What am I doing wrong?
In your display method, you declare the instance variable @board but you don’t set its value to anything. Instance variables default to nil, which is why your test is getting nil. You have to set the value of @board in your display method.
Also, since you will be setting @board in the display method, you don’t need to set it in initialize
Like what Jason said, you should be declaring your board instance variable in the display method because that is what the specs want. Also, if you look at your initialize method. You set @board = board. However, board is not defined there, but rather in your display method. So, you have access to the current board object in your display method not in your initialize method.
There is nothing restricting you from having the board variable in the initialize method. You just have to add the board as an argument like so def initialize(name, board). However, the specs want the board initialized differently so