Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Last active December 28, 2015 05:49
Show Gist options
  • Save ashleygwilliams/7452575 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/7452575 to your computer and use it in GitHub Desktop.
#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
#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
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