spec/csl/treelike_spec.rb in csl-1.2.1 vs spec/csl/treelike_spec.rb in csl-1.2.2

- old
+ new

@@ -17,83 +17,83 @@ let(:lvl1) { TestTree.new.add_child(TestTree.new) } let(:lvl2) { TestTree.new.add_child(TestTree.new).add_child(TestTree.new) } it 'has no children by default' do - node.should_not have_children + expect(node).not_to have_children end it 'is empty by default' do - node.should be_empty + expect(node).to be_empty end describe '#children' do it 'is empty by default' do - node.children.should be_empty + expect(node.children).to be_empty end it 'grows when adding child nodes' do expect { node << TestTree.new }.to change { node.children.length }.by(1) end end describe '#nodename' do it 'returns the class name in attribute form by default' do - node.nodename.should == 'test-tree' + expect(node.nodename).to eq('test-tree') end end describe '#ancestors' do it 'returns and empty list by default' do - node.ancestors.should be_empty + expect(node.ancestors).to be_empty end it 'returns a list with one ancestor at level 1' do - lvl1.ancestors.should have(1).element + expect(lvl1.ancestors.size).to eq(1) end it 'the last ancestor is also the root node at levels 1 and deeper' do - lvl1.ancestors.last.should be_root - lvl2.ancestors.last.should be_root + expect(lvl1.ancestors.last).to be_root + expect(lvl2.ancestors.last).to be_root end it 'returns a list with two ancestors at level 2' do - lvl2.ancestors.should have(2).elements + expect(lvl2.ancestors.size).to eq(2) end end it 'is a root node by default' do - node.should be_root + expect(node).to be_root end describe '#root' do it 'returns self at level 0' do - node.root.should equal(node) + expect(node.root).to equal(node) end it 'returns the parent at level 1' do - lvl1.root.should == lvl1.parent + expect(lvl1.root).to eq(lvl1.parent) end it 'returns parent.parent at level 2' do - lvl2.root.should == lvl2.parent.parent + expect(lvl2.root).to eq(lvl2.parent.parent) end end describe '#depth' do it 'returns 0 by default' do - node.depth.should == 0 + expect(node.depth).to eq(0) end it 'returns 1 at level 1' do - lvl1.depth.should == 1 + expect(lvl1.depth).to eq(1) end it 'returns 2 at level 2' do - lvl2.depth.should == 2 + expect(lvl2.depth).to eq(2) end it 'grows when the node is added to another node' do expect { TestTree.new << node }.to change { node.depth }.by(1) end @@ -109,26 +109,26 @@ include Treelike end end it 'the class contains a children struct' do - TestTree.const?(:Children).should be true + expect(TestTree.const?(:Children)).to be true end describe '.create_children' do it 'returns the children struct' do - TestTree.create_children.should be_a(Struct) + expect(TestTree.create_children).to be_a(Struct) end end describe '#children' do it 'returns a children struct instance' do - TestTree.new.children.should be_a(Struct) + expect(TestTree.new.children).to be_a(Struct) end end it 'has no children by default' do - TestTree.new.should_not have_children + expect(TestTree.new).not_to have_children end it 'has children when adding child nodes' do expect { node << TestTree.new }.to change { node.has_children? }.to(true) end \ No newline at end of file