-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbook_spec.rb
More file actions
39 lines (30 loc) · 905 Bytes
/
book_spec.rb
File metadata and controls
39 lines (30 loc) · 905 Bytes
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
require_relative "spec_helper"
describe Book do
let(:option_a) { Page.create }
let(:option_b) { Page.create }
let!(:page) {Page.create(starting_point: true, option_a_id: option_a.id, option_b_id: option_b.id)}
subject { Book.new(page) }
it "should have a page" do
subject.current_page.should eq(page)
end
describe "#input" do
it "should receive input and opens page" do
subject.input("A")
subject.current_page.should eq(option_a)
end
it "should receive input and opens page" do
subject.input("B")
subject.current_page.should eq(option_b)
end
it "should still work with lower case inputs" do
subject.input("a")
subject.current_page.should eq(option_a)
end
end
describe "#complete_game?" do
it "should know when it's done" do
subject.stub(:current_page) { stub(:conclusion? => true)}
subject.complete_game?.should be_true
end
end
end