In an attempt to create tests for my tic-tac-toe game, I encountered some errors stating 'ReferenceError: CountClick is not defined' and 'ReferenceError: Board is not defined'.
My assumption is that the TicTacToeSpec file is having trouble accessing my TicTacToe.js file. How can I establish a connection between the two?
Location of TicTacToeSpec file: spec/javascripts/TicTacToeSpec.js
describe('Count clicks', function() {
it('adds 1 to counter when clicked', function() {
counter = 0;
CountClick();
expect(counter).toEqual(1);
});
});
Location of index.html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript'></script>
<script src="TicTacToe.js"></script>
<script src="spec/javascripts/TicTacToeSpec.js"></script>
Contents of Gemfile:
gem 'jquery-rails', '~> 2.0.0'
gem 'jasmine'
gem 'jasminerice'
Content of TicTacToe.js:
function CountClick() {
counter++;
};
function Board() {
this.initialBoard();
this.newBoard();
game.firstMove();
}