diff --git a/Gemfile.lock b/Gemfile.lock index dfd2ba5..8389b6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,3 +20,9 @@ PLATFORMS DEPENDENCIES rspec (~> 3.0.0.beta2) + +RUBY VERSION + ruby 2.0.0p648 + +BUNDLED WITH + 1.15.1 diff --git a/lib/deaf_grandma.rb b/lib/deaf_grandma.rb index 83ad52a..65078e3 100644 --- a/lib/deaf_grandma.rb +++ b/lib/deaf_grandma.rb @@ -5,7 +5,7 @@ class DeafGrandma def initialize - @bye_counter = 0 + @bye_counter = 0 end def run! @@ -19,9 +19,15 @@ def run! def speak(input) - - #Implement your code here <<<<<<<<< - + counter = 0 + if input == input.downcase + return "SPEAK UP SONNY!" + elsif input == input.upcase && input != "BYE" + return "NOT SINCE 1964!" + elsif input == input.upcase && input == "BYE" + return "SEE YOU LATER SONNY!" + exit + end end private diff --git a/lib/fizzbuzz.rb b/lib/fizzbuzz.rb index 86f9def..df44330 100644 --- a/lib/fizzbuzz.rb +++ b/lib/fizzbuzz.rb @@ -1,8 +1,15 @@ class SuperFizzBuzz def run(input) - - #Implement your code here + if input % 3 == 0 && input % 5 == 0 + return "FizzBuzz" + elsif input % 5 == 0 + return "Buzz" + elsif input % 3 == 0 + return "Fizz" + else + return input + end end diff --git a/spec/deaf_grandma_spec.rb b/spec/deaf_grandma_spec.rb index cf09766..b2efb59 100644 --- a/spec/deaf_grandma_spec.rb +++ b/spec/deaf_grandma_spec.rb @@ -5,14 +5,14 @@ let(:script) { DeafGrandma.new } it "says 'SPEAK UP SONNY!' when we speak regularly" do - expect(script.speak("Hi Grandma")).to eq "SPEAK UP SONNY!" + expect(script.speak("hi grandma")).to eq "SPEAK UP SONNY!" end - + it "says 'NOT SINCE 1964!' when we yell" do - #implement your test here + expect(script.speak("YELL")).to eq "NOT SINCE 1964!" end it "EXTRA CREDIT: How would you test yelling BYE?" do - #implement your test here + expect(script.speak("BYE")).to eq "SEE YOU LATER SONNY!" end end diff --git a/spec/fizzbuzz_spec.rb b/spec/fizzbuzz_spec.rb index cfda46b..480331f 100644 --- a/spec/fizzbuzz_spec.rb +++ b/spec/fizzbuzz_spec.rb @@ -7,16 +7,16 @@ it "returns 'Fizz' when my input is divisible by 3" do expect(script.run(3)).to eq "Fizz" end - + it "returns 'Buzz' when my input is divisible by 5" do - #implement your test here + expect(script.run(5)).to eq "Buzz" end it "returns 'FizzBuzz' when input is divisible by 3 & 5" do - #implement your test here + expect(script.run(15)).to eq "FizzBuzz" end - + it "returns the input number when input isn't divisible by 3, 5, or both" do - #implement your test here + expect(script.run(1)).to eq 1 end end