Skip to content

Conversation

pdai1y
Copy link

@pdai1y pdai1y commented Apr 5, 2014

I'm sure there is an easier way for me to return a value from a method rather than what I have done here.

I'm also learning Rspec as I go along, its been about 2 weeks since I've really taken a stab at learning Ruby..

Any suggestions on making better tests?

Edit: Panda & Tiger level included

##
# Initialize new vehicle; if no arguments are provided, default to "None"
def initialize(args)
@color = args[:color] ||= "None"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but I prefer using "fetch" in this circumstance:

@color = args.fetch(:color, "None")

@jwo
Copy link
Member

jwo commented Apr 7, 2014

Your tests are great -- nothing to add there.

The updater method was perfect as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants