-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuffer_spec.rb
More file actions
42 lines (34 loc) · 916 Bytes
/
buffer_spec.rb
File metadata and controls
42 lines (34 loc) · 916 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
40
41
require 'spec_helper'
describe BBCoder::Buffer do
context "#push" do
it "should append content onto the current depth without increasing depth" do
subject.push("content")
subject.push(" + more")
subject.pop.should == "content + more"
end
end
context "#pop" do
it "should delete the current depth but not modify the depth" do
subject.push("content")
subject.pop
subject.pop.should == nil
end
end
context "#join" do
it "should push remaining tags" do
mock(subject).tags.stub!.join {"joined"}
mock(subject).push(is_a(String))
subject.join
end
it "should return a string from unopened tags" do
subject.tags.push("p")
subject.join.should == "[p]"
end
end
context "#depth" do
it "should delegate to tags" do
mock(subject).tags.stub!.size {0}
subject.depth.should == 0
end
end
end