Skip to content

markevan100/MythicalCreatures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Mythical Creatures

A collection of exercises to practice Ruby and TDD

How to Run

In order to complete these exercises create a class for each of the mythical creatures in the test directory.

Navigate to the mythical-creatures directory in your terminal, and then run your first test:

ruby test/unicorn_test.rb

That will likely produce an error saying that no unicorn.rb file exists.

If you get an error regarding minitest you may need to run the following command from your terminal:

gem install minitest

Otherwise, Create that file in the lib directory (touch lib/unicorn.rb) and then run your test again. Continue to follow the errors that your test provides until the test passes. Then, unskip the next test by removing the line that says skip. Continue until all tests pass for all creatures.

Suggested Order

  • unicorn_test.rb
  • vampire_test.rb
  • dragon_test.rb
  • hobbit_test.rb
  • pirate_test.rb
  • wizard_test.rb
  • medusa_test.rb
  • werewolf_test.rb
  • centaur_test.rb

Extra Challenges

Testing with RSpec

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.

The Dreaded if Statement

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.

Imagine Two Creatures

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages