Created
March 11, 2012 02:00
-
-
Save MichaelMartinez/2014544 to your computer and use it in GitHub Desktop.
CoffeeScript StrCalc Kata - Jasmine Spec's
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
describe "StringCalc", -> | |
describe "constructor with null", -> | |
beforeEach -> | |
@mystrCalc = new StrCalc() | |
it 'replaces null with 0', -> | |
(expect @mystrCalc.firstNum).toEqual 0 | |
describe "constructor with zero ", -> | |
beforeEach -> | |
@mystrCalc = new StrCalc('0') | |
it 'replaces "0" with 0', -> | |
(expect @mystrCalc.firstNum).toEqual 0 | |
describe "constructor with multiple numbers", -> | |
beforeEach -> | |
@mystrCalc = new StrCalc('1, 2, 3') | |
it 'matches first arg to firstNum', -> | |
(expect @mystrCalc.firstNum).toEqual 1 | |
it 'matches second arg to secondNum', -> | |
(expect @mystrCalc.secondNum).toEqual 2 | |
it 'matches third arg to thirdNum', -> | |
(expect @mystrCalc.thirdNum).toEqual 3 | |
describe "add method", -> | |
beforeEach -> | |
@mystrCalc = new StrCalc('2, 4, 6') | |
it 'adds three arguments of StrCalc', -> | |
(expect @mystrCalc.total).toEqual 12 | |
describe "add method with bigger numbers", -> | |
beforeEach -> | |
@mystrCalc = new StrCalc('20\n40, 60') | |
it 'adds three arguments for big numbers and wacky delimiters', -> | |
(expect @mystrCalc.total).toEqual 120 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment