Created
November 10, 2011 18:54
-
-
Save gonzedge/1355752 to your computer and use it in GitHub Desktop.
Unit testing the jQuery Rambling Slider – CoffeeScript, Jasmine and node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array::contains = (value) -> | |
length = @length | |
for i in [0...length] | |
return true if value is @[i] | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require '../src/array_extensions' | |
describe 'Array Extensions', -> | |
describe 'when verifying if an array contains an element', -> | |
array = null | |
beforeEach -> | |
array = [1...5] | |
it 'should return true for a contained element', -> | |
expect(array.contains(1)).toBeTruthy() | |
it 'should return false for a non contained element', -> | |
expect(array.contains(5)).toBeFalsy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g jasmine-node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jasmine-node --coffee spec/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment