-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpage_spec.rb
More file actions
48 lines (37 loc) · 1.16 KB
/
page_spec.rb
File metadata and controls
48 lines (37 loc) · 1.16 KB
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
require_relative "spec_helper"
describe Page do
before(:each) do
Page.delete_all
end
it "should know if it's at the end of the road" do
page = Page.create(conclusion: true)
page.conclusion?.should be_true
end
it "should have awesome content" do
page = Page.create(content: "The fox and hound get along")
Page.find(page.id).content.should eq("The fox and hound get along")
end
it "should have a preview" do
page = Page.create(preview: "Step into the forest")
expect(Page.find(page.id).preview).to eq("Step into the forest")
end
context "#options" do
let(:option_a) {Page.create }
let(:option_b) {Page.create }
let(:option_c) {Page.create }
subject {Page.create(option_ids: [option_a, option_b])}
it "should have options for the next pages" do
subject.option_ids.should eq([option_a, option_b])
end
end
it "should not be a starting point by default" do
Page.create.starting_point.should eq(false)
end
it "should not be a conclusion by default" do
Page.create.conclusion.should eq(false)
end
it "should have a starting point" do
the_page = Page.create(starting_point: true)
Page.starting_point.should eq(the_page)
end
end