- Clone this SalesEngine repo.
- If you already have a directory named sales_engine, you can rename it when you run
git clone
.
- Checkout the
needs_refactoring
branch andbundle
. - Run the specs with
rspec
. You should have three passing specs. - Take a minute to review what is being tested and how that's happening.
- Open up
lib/customer_repository.rb
... This doesn't look so good.
The specs should stay green without changing them.
- Make a private method so we don't need to access
@customers_array
directly. - Refactor the
#random
method so it's more clear. #find_by_last_name
and#find_all_by_first_name
are ugly. Make them pretty.#create_customers
is doing too much. Split in two methods.- This class is doing too much. Split it in two. What code smell do you notice to determine what should be moved?