Skip to content

Commit

Permalink
Merge pull request #4 from LTe/collection
Browse files Browse the repository at this point in the history
Don't use default separator
  • Loading branch information
gregbell committed Aug 23, 2012
2 parents 5b46699 + ed8f25e commit cd855fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/arbre/element_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def &(other)
def to_s
self.collect do |element|
element.to_s
end.join.html_safe
end.join('').html_safe
end
end

Expand Down
13 changes: 13 additions & 0 deletions spec/arbre/unit/element_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,24 @@ def helper_method

describe "rendering to html" do

before { @separator = $, }
after { $, = @separator }
let(:collection){ element + "hello world" }

it "should render the children collection" do
element.children.should_receive(:to_s).and_return("content")
element.to_s.should == "content"
end

it "should render collection when is set the default separator" do
$, = "_"
collection.to_s.should == "hello world"
end

it "should render collection when is not set the default separator" do
collection.to_s.should == "hello world"
end

end

describe "adding elements together" do
Expand Down

0 comments on commit cd855fd

Please sign in to comment.