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
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
ruby '2.0.0'
ruby '2.3.3'

gem 'rspec', '~> 3.0.0.beta2'
gem 'rspec', '~> 3.0.0.beta2'
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ GEM

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
rspec (~> 3.0.0.beta2)

RUBY VERSION
ruby 2.3.3p222

BUNDLED WITH
1.16.2
15 changes: 12 additions & 3 deletions lib/deaf_grandma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class DeafGrandma

def initialize
@bye_counter = 0
@bye_counter = 0
end

def run!
Expand All @@ -20,8 +20,17 @@ def run!

def speak(input)

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

if input == "BYE" && @bye_counter >= 2
p "SEE YOU LATER SONNY"
exit
elsif input == "BYE"
@bye_counter += 1
"NOT SINCE 1964!"
elsif input === input.upcase
"NOT SINCE 1964!"
else
"SPEAK UP SONNY!"
end
end

private
Expand Down
11 changes: 9 additions & 2 deletions lib/fizzbuzz.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
class SuperFizzBuzz

def run(input)

#Implement your code here
if input % 3 == 0 && input % 5 == 0
"FizzBuzz"
elsif input % 3 == 0
"Fizz"
elsif input % 5 == 0
"Buzz"
else
input
end

end

Expand Down
10 changes: 7 additions & 3 deletions spec/deaf_grandma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
it "says 'SPEAK UP SONNY!' when we speak regularly" do
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("HI GRANDMA")).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 "NOT SINCE 1964!"
expect(script.speak("BYE")).to eq "NOT SINCE 1964!"
#expect(script.speak("HI GRANDMA")).to eq "NOT SINCE 1964!"
#script.speak("BYE")
expect{script.speak("BYE")}.to raise_error(SystemExit)
end
end
10 changes: 5 additions & 5 deletions spec/fizzbuzz_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(17)).to eq 17
end
end