Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use default separator #4

Merged
merged 1 commit into from
Aug 23, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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