Conversation
lib/sales_person.rb
Outdated
There was a problem hiding this comment.
You can simplifiy this select to
start = @cities.select {|city| city.name == start_name }The reason is that select works by keeping entries in the array where the block returns true. A simply example:
[1,4,5,6].select{|i| true}
=> [1,4,5,6]There was a problem hiding this comment.
Further, since you are getting the first item, you can change to a find
def find_point(start_name)
@cities.find {|city| city.name == start_name }
endThis works where it early escapes after finding a true element
[2,3,3,3,4,5].find {|i| i.odd?}
=> 3
|
Excellent job! Especially nice job on the spec, with both should-equal and message expectations (should_receive). 👍 🎉 |
|
Hey Jesse, My code is a mess still. I can’t get benchmark to work…and my Rspec is all over the place. but I wanted to upload it…instead of just sitting on it and waiting for it to hatch.
|
There was a problem hiding this comment.
Please leave the license files. (unless you plan to delete your repo)
|
Some promise here! The spec's don't pass though... want to take another run at the specs? |
I still haven't updated my spec. Thanks.