Skip to content

Instantly share code, notes, and snippets.

@gonzedge
Created November 10, 2011 18:54
Show Gist options
  • Save gonzedge/1355752 to your computer and use it in GitHub Desktop.
Save gonzedge/1355752 to your computer and use it in GitHub Desktop.
Unit testing the jQuery Rambling Slider – CoffeeScript, Jasmine and node.js
Array::contains = (value) ->
length = @length
for i in [0...length]
return true if value is @[i]
false
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()
npm install -g jasmine-node
jasmine-node --coffee spec/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment