From 5416c672d5c76dc6af5fe0a69674f20a356f7ac6 Mon Sep 17 00:00:00 2001 From: Gustavo Gonzalez Date: Thu, 20 Apr 2017 14:22:47 -0500 Subject: [PATCH] Fix sounds_for_number when number is nineteen --- lib/ahnsay.rb | 2 +- spec/ahnsay_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ahnsay.rb b/lib/ahnsay.rb index 7ab5575..d338466 100644 --- a/lib/ahnsay.rb +++ b/lib/ahnsay.rb @@ -169,7 +169,7 @@ def sounds_for_number(number) result << "#{hundreds}.ul" << "hundred.ul" end rest = rest % 100 - if rest < 19 + if rest < 20 result << "#{rest}.ul" else tens = (rest / 10).floor diff --git a/spec/ahnsay_spec.rb b/spec/ahnsay_spec.rb index 9f44fa5..88d686d 100644 --- a/spec/ahnsay_spec.rb +++ b/spec/ahnsay_spec.rb @@ -71,7 +71,7 @@ subject.sounds_for_number(23).should == ["sounds/20.ul", "sounds/3.ul"] end it "returns the expected array for a number with tens below 20" do - subject.sounds_for_number(13).should == ["sounds/13.ul"] + subject.sounds_for_number(19).should == ["sounds/19.ul"] end it "returns the expected array for a number that is a multiple of 10" do subject.sounds_for_number(20).should == ["sounds/20.ul"]