Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
fix Rxhp::Html#fragment - should return a Fragment, nor an Array
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Feb 5, 2012
1 parent a90a49c commit 90bcf16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rxhp/html.rb
Expand Up @@ -16,7 +16,9 @@ module Html
# text 'bar'
# end
def fragment x
Rxhp::Scope.current.children.push x
scope = Rxhp::Scope.current
scope.children.push x
scope
end
alias :frag :fragment
alias :text :fragment
Expand Down
7 changes: 7 additions & 0 deletions spec/html_spec.rb
Expand Up @@ -13,9 +13,16 @@ def foo
end
end
end
@klass = klass
@result = klass.new.foo
end

it 'creates an Rxhp::Fragment' do
@klass.new.instance_eval do
fragment 'foo'
end.should be_a Rxhp::Fragment
end

it 'adds a child' do
@result.children.should include 'foo'
end
Expand Down

0 comments on commit 90bcf16

Please sign in to comment.