Add tests for the following specifications and make them pass one at a time.
-
- A fan should not be valid without an email.
-
- A location is valid with a city, state, and country and should be invalid if they are missing a city, state, or country.
-
- A city must be unique within the scope of a state. For example, we can have Bloomington, IL, and Bloomington, IN, but we can't have two of Bloomington, IN.
-
- A state must be exactly two characters. Take a look at the documentation to figure out how to do exact length validations.
-
- Cities and countries may only contain uppercase letters, lowercase letters, and spaces.
-
- Donations must have an amount that can only be whole numbers. Take a look at the documentation for a built-in way to write this.
-
- A donations must have a status. Donation statuses can be "processed", "pending", or "cancelled". No other values should be allowed.
-
- Donations of 1 dollar are not allowed. Don't be cheap.
-
- When calling
full_name
on a location, it should return a string of the city, state, and country. (Example:location.full_name
returns "Denver, CO, USA")
- When calling
-
- A donation should belong to a fan.
-
Fan.all
should return all fans ordered alphabetically by name.
-
Fan.joined_since(date)
should return all the fans that have joined since that date.