Move 3 / 22. From green to green in 104 seconds.
0
comment(s).
3 modification(s).
Kata Summary
========== AsyncSpec.coffee ==========
=
========== AsyncSpec.coffee ==========
This piece was cognet, well-written, and pithy.
=
#=============================================================================
=
#=============================================================================
# Async spec, that will be time outed
=
# Async spec, that will be time outed
#=============================================================================
=
#=============================================================================
describe 'async', ->
=
describe 'async', ->
it 'should be timed out', ->
=
it 'should be timed out', ->
waitsFor (-> false), 'MIRACLE', 500
=
waitsFor (-> false), 'MIRACLE', 500
=
=
=
========== CoffeeSpec.coffee ==========
=
========== CoffeeSpec.coffee ==========
=
describe 'jasmine-node', ->
=
describe 'jasmine-node', ->
=
it 'should pass', ->
=
it 'should pass', ->
expect(1+2).toEqual(3)
=
expect(1+2).toEqual(3)
=
=
========== GrammarHelper.coffee ==========
=
========== GrammarHelper.coffee ==========
=
global.testClass = (description, specDefinitions) ->
=
global.testClass = (description, specDefinitions) ->
suite = jasmine.getEnv().describe('Class: ' + description, specDefinitions)
=
suite = jasmine.getEnv().describe('Class: ' + description, specDefinitions)
suite.tags = ['class']
=
suite.tags = ['class']
suite.isIntermediate = true;
=
suite.isIntermediate = true;
suite
=
suite
=
global.feature = (description, specDefinitions) ->
=
global.feature = (description, specDefinitions) ->
suite = jasmine.getEnv().describe('Feature: ' + description, specDefinitions)
=
suite = jasmine.getEnv().describe('Feature: ' + description, specDefinitions)
suite.tags = ['feature']
=
suite.tags = ['feature']
suite.isIntermediate = true;
=
suite.isIntermediate = true;
suite
=
suite
=
global.scenario = (desc, func) ->
=
global.scenario = (desc, func) ->
suite = jasmine.getEnv().describe('Scenario: ' + desc, func)
=
suite = jasmine.getEnv().describe('Scenario: ' + desc, func)
suite.tags = ['scenario']
=
suite.tags = ['scenario']
suite.isIntermediate = true;
=
suite.isIntermediate = true;
suite
=
suite
=
global.should = (description, specDefinitions) ->
=
global.should = (description, specDefinitions) ->
suite = jasmine.getEnv().it('It should ' + description, specDefinitions)
=
suite = jasmine.getEnv().it('It should ' + description, specDefinitions)
suite.tags = ['should']
=
suite.tags = ['should']
suite
=
suite
=
=
========== HelperSpec.coffee ==========
=
========== HelperSpec.coffee ==========
=
=
testClass 'HelperLoader', ->
=
testClass 'HelperLoader', ->
feature 'Loading order', ->
=
feature 'Loading order', ->
should 'load the helpers before the specs.', ->
=
should 'load the helpers before the specs.', ->
expect(true).toBeTruthy()
=
expect(true).toBeTruthy()
# will fail to parse the spec if the helper was not loaded first
=
# will fail to parse the spec if the helper was not loaded first
=
=
========== dojoSpec.coffee ==========
=
========== dojoSpec.coffee ==========
=
# This is a workaround to prevent jasmine-node from executing spec files in the .codersdojo directory
=
# This is a workaround to prevent jasmine-node from executing spec files in the .codersdojo directory
require '../kataSpec'
=
require '../kataSpec'
=
=
=
========== kataSpec.coffee ==========
=
========== kataSpec.coffee ==========
=
primenumbers = require './prime-numbers'
=
primenumbers = require './prime-numbers'
=
describe 'The Prime-numbers', ->
=
describe 'The Prime-numbers', ->
for n in [0..3]
=
for n in [0..3]
do (n) ->
=
do (n) ->
describe "of #{n}", ->
=
describe "of #{n}", ->
it "should be [#{n}]", ->
=
it "should be [#{n}]", ->
expect(primenumbers.prime(n)).toEqual([n])
=
expect(primenumbers.prime(n)).toEqual([n])
=
describe 'of 4', ->
=
describe 'of 4', ->
it 'should be [2, 2]', ->
=
it 'should be [2, 2]', ->
expect(primenumbers.prime(4)).toEqual [2, 2]
=
expect(primenumbers.prime(4)).toEqual [2, 2]
=
=
========== prime-numbers.coffee ==========
=
========== prime-numbers.coffee ==========
=
prime = (number) ->
=
prime = (number) ->
if number < 4
=
if number < 4
[number]
=
[number]
else
=
else
[2, 2]
=
[2, 2]
=
<
findPrime = (number, factor, foundPrimes) ->
<
<
exports.prime = prime
=
exports.prime = prime
=
=
========== specs.coffee ==========
=
========== specs.coffee ==========
=
describe "prime factors", ->
=
describe "prime factors", ->
describe "of 0", ->
=
describe "of 0", ->
it "is 0", ->
=
it "is 0", ->
expect(primeFactors(0)).toEqual([0])
=
expect(primeFactors(0)).toEqual([0])
=
describe "of 1", ->
=
describe "of 1", ->
it "is 1", ->
=
it "is 1", ->
expect(primeFactors(1)).toEqual([1])
=
expect(primeFactors(1)).toEqual([1])
=
describe "of 2", ->
=
describe "of 2", ->
it "is 2", ->
=
it "is 2", ->
expect(primeFactors(2)).toEqual([2])
=
expect(primeFactors(2)).toEqual([2])
=
describe "of 4", ->
=
describe "of 4", ->
it "are [2, 2]", ->
=
it "are [2, 2]", ->
expect(primeFactors(4)).toEqual([2, 2])
=
expect(primeFactors(4)).toEqual([2, 2])
=
describe "of 6", ->
=
describe "of 6", ->
it "are [2, 3]", ->
=
it "are [2, 3]", ->
expect(primeFactors(6)).toEqual([2, 3])
=
expect(primeFactors(6)).toEqual([2, 3])
=
describe "of 8", ->
=
describe "of 8", ->
it "are [2, 2, 2]", ->
=
it "are [2, 2, 2]", ->
expect(primeFactors(8)).toEqual([2, 2, 2])
=
expect(primeFactors(8)).toEqual([2, 2, 2])
=
describe "of 10", ->
=
describe "of 10", ->
it "are [2, 5]", ->
=
it "are [2, 5]", ->
expect(primeFactors(10)).toEqual([2, 5])
=
expect(primeFactors(10)).toEqual([2, 5])
=
describe "of 37", ->
=
describe "of 37", ->
it "are [37]", ->
=
it "are [37]", ->
expect(primeFactors(37)).toEqual([37])
=
expect(primeFactors(37)).toEqual([37])
=
primeFactors = (number) ->
=
primeFactors = (number) ->
if number < 4
=
if number < 4
[number]
=
[number]
else
=
else
findFactors(number, 2)
=
findFactors(number, 2)
=
findFactors = (number, nextFactor) ->
=
findFactors = (number, nextFactor) ->
if number == 1
=
if number == 1
return []
=
return []
=
if number % nextFactor == 0
=
if number % nextFactor == 0
[nextFactor].concat findFactors(number / nextFactor, nextFactor)
=
[nextFactor].concat findFactors(number / nextFactor, nextFactor)
else
=
else
findFactors(number, nextFactor + 1)
=
findFactors(number, nextFactor + 1)
.....
Finished in 0.005 seconds
5 tests, 5 assertions, 0 failures
.....
Finished in 0.005 seconds
5 tests, 5 assertions, 0 failures
« Previous
1
2
3
4
5
6
7
8
...
22
Next »
Finished in 0.005 seconds
5 tests, 5 assertions, 0 failures
Finished in 0.005 seconds
5 tests, 5 assertions, 0 failures