Skip to content
Open
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
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
source 'https://rubygems.org'
ruby '2.0.0'

gem 'rspec', '~> 3.0.0.beta2'
25 changes: 20 additions & 5 deletions lib/deaf_grandma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize

def run!
print_welcome

loop do
user_input = get_user_input
p speak(user_input)
Expand All @@ -19,13 +19,28 @@ def run!


def speak(input)

#Implement your code here <<<<<<<<<

if input == "BYE"
handle_bye
elsif input == input.upcase
"NOT SINCE 1964!"
else
"SPEAK UP SONNY!"
end
end

private

def handle_bye
@bye_counter += 1
if @bye_counter == 3
p "SEE YOU LATER SONNY"
exit
else

""
end
end

def print_welcome
puts "\nSpeak to your Grandmother: "
end
Expand All @@ -38,4 +53,4 @@ def get_user_input
end

#Uncomment this next line to run your script but BE SURE to comment it, before you try and run your tests.
#DeafGrandma.new.run!
# DeafGrandma.new.run!
8 changes: 4 additions & 4 deletions spec/deaf_grandma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
end

it "says 'NOT SINCE 1964!' when we yell" do
#implement your test here
expect(script.speak("HI GRANDMA")).to eq "NOT SINCE 1964!"
end

it "EXTRA CREDIT: How would you test yelling BYE?" do
#implement your test here
end
# it "says 'SEE YOU LATER SONNY!' when we say BYE 3 times" do
# expect(script.speak("BYE")).to eq "SEE YOU LATER SONNY!"
# end
end