Skip to content

Instantly share code, notes, and snippets.

@rapala61
Last active December 14, 2015 20:53
Show Gist options
  • Save rapala61/237d06d5bf61943759ed to your computer and use it in GitHub Desktop.
Save rapala61/237d06d5bf61943759ed to your computer and use it in GitHub Desktop.
RSpec Lab, based on already existing project seen in class. Modify accordingly if the project is to be also created as part of the Lab.

BDD with RSpec Lab (50m)

We are now going to continue building features for our employer HonestBank! 😉

We are going to use the TDD methodology. This means:

  1. You are going to write the test BEFORE you implement the feature.
  2. Run the test suite and watch it fail! ✅🔥🔥
  3. Then, you are going to implement the feature in the appropriate model.
  4. Run the test suite AGAIN and watch it succeed! ✅✅✅

Exercise

Requirements

The client has called and we need to get a few features in before the end of the class. Our CTO has given you the following user cases to create tests in the appropriate models:

  • An user should be able to get their full name.

  • An user should be able to get a global balance based on all accounts minus fees.

  • An account should have a status of 'overdrawn' when the balance is less than 0.

  • An account should not dispense any money if its overdrawn.

BONUS It would be nice if we could add these features too:

  • An account should not dispense any money if the pin is incorrect.

  • An user should be able to list all accounts that are overdrawn.

  • An user should be able to get a global amount of fees owed to the bank.

Deliverable

  • Send me all 4 spec files when you are done to my slack room.

Additional Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment