A collection of simple exercises to practice Ruby and TDD
unicorn_test.rb
donevampire_test.rb
donedragon_test.rb
donehobbit_test.rb
donepirate_test.rb
donewizard_test.rb
donemedusa_test.rb
donewerewolf_test.rb
donecentaur_test.rb
done
For the majority of the class we use minitest because there's so little to learn about the API. But a huge part of the Ruby community favors the expressiveness of RSpec.
- You can check out one of our tutorials about RSpec or this blog post
- Pick three of the creatures and implement RSpec tests for each
- For each creature, add at least three additional tests / pieces of functionality
- Submit pull requests adding the RSpec tests to the repository
Can you complete implementations of each of the creatures without using if
statements? Think about how removing them affects your code. Remember that
a case
is just a different form of if
, so don't use it.
Can you add two new creatures to the repository? How about a Hydra? Add minitest tests exercising some of the following concepts:
- Passing data into
initialize
- Using methods to change the internal state of an instance
- Using methods to query the internal state of an instance
- Functionality that necessitates the internal use of an Array