-
Notifications
You must be signed in to change notification settings - Fork 79
Finished challenge - David and Luke #98
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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' | ||
| gem 'rspec', '~> 3.0.0.beta2' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,15 @@ | |
| 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 WHEN DID YOU LAST EAT NOODLES.")).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!" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We only want Grandma to respond if you have yelled 3 times at her. Think about how you could write a test to make sure the first two times you say bye, she doesn't respond.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made fix to return empty string |
||
| expect(script.speak("BYE")).to eq "NOT SINCE 1964!" | ||
| expect(script.speak("BYE")).to eq "SEE YOU LATER SONNY!" | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job solving it! Does this method look like it's got a lot of decisions being made? Think about how you might be able to refactor this to make the code paths a little easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored the code to reduce if statements and minimize code block length