Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #1422

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Done #1422

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions how_old_are_you.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative './current_age_for_birth_year.rb'

puts "What year were you born?"
birth_year = gets.to_i

users_age = current_age_for_birth_year(birth_year)

puts "You are: " "+ users_age.to_s + " " years old."
6 changes: 5 additions & 1 deletion spec/current_age_for_birth_year_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
describe "current_age_for_birth_year method" do
it "returns the age of a person based on the year of birth" do
age_of_person = current_age_for_birth_year(1984)

expect(age_of_person).to eq(32)
end
end

def current_age_for_birth_year (birth_year)
2016 - birth_year
end
8 changes: 8 additions & 0 deletions spec/how_old_are_you.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative './current_age_for_birth_year.rb'

puts "What year were you born?"
birth_year = gets.to_i

users_age = current_age_for_birth_year(birth_year)

puts "You are: " "+ users_age.to_s + " " years old."