Now, let's rebuild fizzbuzz with approvals.
Hint: use Split Editor to follow along
Note: take your time, we don't have to complete all steps
-
reset the code to its starting position
- there's a script for that on the
./menu.sh
- there's a script for that on the
-
run the approval test
- there's a script for that too on the
./menu.sh
- see it fail
- see the diff tool open
- there's a script for that too on the
-
make the test pass with no errors (you can follow links with
ctrl + enter
) test is here code is here- make the code right
- "approve" the result
- copy from left to right in the diff tool
- use the UI button
- save
- copy from left to right in the diff tool
- see the test pass
-
run the approval test continuously in the terminal
- you can find the relevant script with
./menu.sh
- test should still pass
- you can find the relevant script with
-
fizzbuzz(2)
- refactor our code to introduce a loop over
n
- see the test still pass for
n == 1
- add
n == 2
to the loop - change the
fizzbuzz
code until the diff is good - "approve" the diff
- see the test pass
- refactor if you like
- refactor our code to introduce a loop over
-
fizzbuzz(3)
- loop up to
n == 3
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
fizzbuzz(4)
- loop up to
n == 4
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
fizzbuzz(5)
- loop up to
n == 5
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
fizzbuzz(6)
- loop up to
n == 6
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
fizzbuzz(10)
- loop up to
n == 10
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
fizzbuzz(15)
- loop up to
n == 15
- change the
fizzbuzz
code until the diff is good - approve the diff
- see the test pass
- refactor if you like
- loop up to
-
loop up to
n == 35
- approve the diff
- see the test pass
- refactor if you like
-
add
Whizz
andBang
, using the same approach as earlier steps see the "Follow-up requirements" section here