-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsimon_says_spec.rb
48 lines (37 loc) · 1.21 KB
/
simon_says_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Hint: require needs to be able to find this file to load it
require_relative "simon_says.rb"
require_relative '../../spec_helper'
describe SimonSays do
include SimonSays # Hint: Inclusion is different than SimonSays.new (read about modules)
# Hint: We are just calling methods, we are not passing a message to a SimonSays object.
it "should echo hello" do
echo("hello").should == "hello"
end
it "should echo bye" do
echo("bye").should == "bye"
end
it "should shout hello" do
shout("hello").should == "HELLO"
end
it "should shout multiple words" do
shout("hello world").should == "HELLO WORLD"
end
it "should repeat" do
repeat("hello").should == "hello hello"
end
it "should repeat a number of times" do
repeat("hello", 3).should == "hello hello hello"
end
it "should return the first letter" do
start_of_word("hello", 1).should == "h"
end
it "should return the first two letters" do
start_of_word("Bob", 2).should == "Bo"
end
it "should tell us the first word of 'Hello World' is 'Hello'" do
first_word("Hello World").should == "Hello"
end
it "should tell us the first word of 'oh dear' is 'oh'" do
first_word("oh dear").should == "oh"
end
end