|
5 | 5 | include Arbre::HTML
|
6 | 6 |
|
7 | 7 | let(:assigns){ {} }
|
8 |
| - let(:element){ Element.new } |
| 8 | + let(:element){ Arbre::HTML::Element.new } |
9 | 9 |
|
10 | 10 | context "when initialized" do
|
11 | 11 | it "should have no children" do
|
|
21 | 21 | element.should respond_to(:span)
|
22 | 22 | end
|
23 | 23 | it "should have a set of local assigns" do
|
24 |
| - element = Element.new :hello => "World" |
| 24 | + element = Arbre::HTML::Element.new :hello => "World" |
25 | 25 | element.assigns[:hello].should == "World"
|
26 | 26 | end
|
27 | 27 | it "should have an empty hash with no local assigns" do
|
|
30 | 30 | end
|
31 | 31 |
|
32 | 32 | describe "passing in a helper object" do
|
33 |
| - let(:element){ Element.new(nil, action_view) } |
| 33 | + let(:element){ Arbre::HTML::Element.new(nil, action_view) } |
34 | 34 | it "should call methods on the helper object and return TextNode objects" do
|
35 | 35 | element.content_tag(:div).should == "<div></div>"
|
36 | 36 | end
|
|
43 | 43 | end
|
44 | 44 |
|
45 | 45 | describe "adding a child" do
|
46 |
| - let(:child){ Element.new } |
| 46 | + let(:child){ Arbre::HTML::Element.new } |
47 | 47 | before do
|
48 | 48 | element.add_child child
|
49 | 49 | end
|
|
66 | 66 | context "when the child is a string" do
|
67 | 67 | let(:child){ "Hello World" }
|
68 | 68 | it "should add as a TextNode" do
|
69 |
| - element.children.first.should be_instance_of(TextNode) |
| 69 | + element.children.first.should be_instance_of(Arbre::HTML::TextNode) |
70 | 70 | element.children.first.to_html.should == "Hello World"
|
71 | 71 | end
|
72 | 72 | end
|
|
123 | 123 |
|
124 | 124 | describe "setting the parent" do
|
125 | 125 | let(:parent) do
|
126 |
| - doc = Document.new |
127 |
| - parent = Element.new |
| 126 | + doc = Arbre::HTML::Document.new |
| 127 | + parent = Arbre::HTML::Element.new |
128 | 128 | doc << parent
|
129 | 129 | parent
|
130 | 130 | end
|
|
162 | 162 | end
|
163 | 163 |
|
164 | 164 | context "when the left is a collection and the right is a tag" do
|
165 |
| - let(:collection){ Collection.new([h1, h2]) + h3} |
| 165 | + let(:collection){ Arbre::HTML::Collection.new([h1, h2]) + h3} |
166 | 166 |
|
167 | 167 | it "should return an instance of Collection" do
|
168 | 168 | collection.should be_an_instance_of(Arbre::HTML::Collection)
|
|
177 | 177 | end
|
178 | 178 |
|
179 | 179 | context "when the right is a collection and the left is a tag" do
|
180 |
| - let(:collection){ h1 + Collection.new([h2,h3]) } |
| 180 | + let(:collection){ h1 + Arbre::HTML::Collection.new([h2,h3]) } |
181 | 181 |
|
182 | 182 | it "should return an instance of Collection" do
|
183 | 183 | collection.should be_an_instance_of(Arbre::HTML::Collection)
|
|
0 commit comments