Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 1be83c7

Browse files
committed
[React::Children] Fix the spec
1. React::Children is considered to be a Enumberable, so only #count method should be defined. 2. React::Children#each will returns a Enumerator, with #size returned nil when cannot count lazily, and in our case, it could be counted lazily.
1 parent 54a66d7 commit 1be83c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/react/component_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,15 @@ def render
710710
children = Foo.the_children
711711

712712
expect(children).to be_a(React::Children)
713-
expect(children.size).to eq(2)
713+
expect(children.count).to eq(2)
714714
expect(children.map(&:element_type)).to eq(['a', 'li'])
715715
end
716716

717717
it 'returns an empty Enumerator if there are no children' do
718718
ele = React.create_element(Foo)
719719
renderElementToDocument(ele)
720720
nodes = Foo.the_children.each
721-
expect(nodes.size).to eq(nil)
721+
expect(nodes.size).to eq(0)
722722
expect(nodes.count).to eq(0)
723723
end
724724
end

0 commit comments

Comments
 (0)