Last active
December 28, 2015 05:49
-
-
Save ashleygwilliams/7452575 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Write a method called is_a_teenager that takes age as a parameter and returns | |
#true/false depending on whether the age indicates that the person is a | |
#teenager | |
#To test your solution run `rspec teenager_spec.rb` in your terminal | |
def is_a_teenager? age | |
age <= 19 && age >= 13 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Write a method called is_a_teenager that takes age as a parameter and returns | |
#true/false depending on whether the age indicates that the person is a | |
#teenager | |
def is_a_teenager? age | |
age > 12 && age < 20 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './teenager' | |
describe "#is_a_teenager?" do | |
it "returns false if the person is younger than 13" do | |
is_a_teenager?(12).should eq(false) | |
end | |
it "returns false if the person is older than 19" do | |
is_a_teenager?(20).should eq(false) | |
end | |
it "returns true if the person is between the ages of 13 and 19" do | |
is_a_teenager?(15).should eq(true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment