Skip to content

Instantly share code, notes, and snippets.

@Leejojo
Created June 22, 2016 00:15
Show Gist options
  • Save Leejojo/8dd24c54827095dc099df9d741b672b8 to your computer and use it in GitHub Desktop.
Save Leejojo/8dd24c54827095dc099df9d741b672b8 to your computer and use it in GitHub Desktop.
Yuppie
# must be baller and either furnished or rent cheaper than 2100
def rent?(baller, furnished, rent)
if baller && (furnished || rent < 2100)
return true
else
return false
end
end
###
# Add your "test" ("driver") code below in order to "test drive" (run) your method above...
# The test code will call the method with different permutations of options and output the result each time.
# This way, you will be able to run the renter.rb file from the CLI and look at the output of your "tests" to validate if the method works.
# Without the test code, it will be hard for you to know if this method is working as it should or not.
###
def test
puts 'test case 1'
puts rent?(true, true, 1000) == true
puts 'test case 2'
puts rent?(false, false, 2000) == false
puts 'test case 3'
puts rent?(true, true, 3000) == true
puts 'test case 4'
puts rent?(true, false, 2200) == false
puts 'test case 5'
puts rent?(false, true, 1000) == false
end
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment