Skip to content

Commit 5df9950

Browse files
author
Jeff Dean
committed
update 99 bottles spec to only pass in a single number
1 parent a348e28 commit 5df9950

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

spec/beer_on_the_wall_spec.rb

+28-35
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,59 @@
11
require 'spec_helper'
22

3-
describe "WallBeer" do
4-
it "prints out the first verse for 99 bottles of beer on the wall, when told to 'sing' with 99" do
3+
describe "beer_on_the_wall" do
4+
5+
it "prints out the first verse for 99 bottles of beer on the wall, when told to 'sing'" do
56
pending
6-
run_script("wall_beer.rb")
7-
type("sing 99")
7+
run_script("beer_on_the_wall.rb")
8+
type("99")
89

910
expect(all_output).to match("99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n")
1011
expect(all_output).to_not include("Fine, don't listen to my song.")
1112
end
1213

13-
it "throws an error if it does not know how many number of bottles" do
14-
pending
15-
run_script("wall_beer.rb")
16-
type("sing")
17-
18-
expect(all_output).to match("I need to know how many bottles to sing!")
19-
expect(all_output).to_not include("1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no bottles of beer on the wall.\n")
20-
end
21-
22-
it "responds with 'Fine, don't listen to my song.', when told anything else besides 'sing''" do
23-
pending
24-
run_script("wall_beer.rb")
25-
type("I don't want to hear you sing")
26-
27-
expect(all_output).to match("Fine, don't listen to my song.")
28-
expect(all_output).to_not include("18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n")
29-
end
30-
31-
it "prints out the lyrics for the rest of the verses, except 2-0, when told to sing" do
14+
it "prints out the lyrics for the rest of the verses" do
3215
pending
33-
run_script("wall_beer.rb")
34-
type("sing 8")
16+
run_script("beer_on_the_wall.rb")
17+
type("8")
3518

36-
expect(all_output).to match("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n. 7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n")
19+
expect(all_output).to match("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n")
3720
expect(all_output).to_not include("Fine, don't listen to my song.")
3821
end
3922

40-
it "prints out the lyrics for 2 bottles of beer, when told to sing" do
23+
it "correctly prints out the lyrics for 2 bottles of beer, when told to sing" do
4124
pending
42-
run_script("wall_beer.rb")
43-
type("sing 2")
25+
run_script("beer_on_the_wall.rb")
26+
type("2")
4427

4528
expect(all_output).to match("2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n")
4629
expect(all_output).to_not include("Fine, don't listen to my song.")
4730
end
4831

49-
it "prints out the lyrics for 1 bottles of beer, when told to sing" do
32+
it "correctly prints out the lyrics for 1 bottle of beer, when told to sing" do
5033
pending
51-
run_script("wall_beer.rb")
52-
type("sing 1")
34+
run_script("beer_on_the_wall.rb")
35+
type("1")
5336

5437
expect(all_output).to match("1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no bottles of beer on the wall.\n")
5538
expect(all_output).to_not include("Fine, don't listen to my song.")
5639
end
5740

58-
it "prints out the lyrics for no bottles of beer, when told to sing and there is no more beer left" do
41+
it "correctly prints out the lyrics for no bottles of beer, when told to sing and there is no more beer left" do
5942
pending
60-
run_script("wall_beer.rb")
61-
type("sing 0")
43+
run_script("beer_on_the_wall.rb")
44+
type("0")
6245

6346
expect(all_output).to match("No bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n")
6447
expect(all_output).to_not include("Fine, don't listen to my song.")
6548
end
49+
50+
it "throws an error if it does not know how many number of bottles" do
51+
pending
52+
run_script("beer_on_the_wall.rb")
53+
type("")
54+
55+
expect(all_output).to match("I need to know how many bottles to sing!")
56+
expect(all_output).to_not include("1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no bottles of beer on the wall.\n")
57+
end
58+
6659
end

0 commit comments

Comments
 (0)