Skip to content

Commit 4f87cbc

Browse files
committed
Minor style improvements to the specs
1 parent ae78bc2 commit 4f87cbc

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

spec/mongoid/tree/ordering_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@
165165
end
166166
end
167167

168-
describe 'ancestors' do
169-
it "#ancestors should be returned in the correct order" do
168+
describe '#ancestors' do
169+
it "should be returned in the correct order" do
170170
setup_tree <<-ENDTREE
171171
- root:
172172
- level_1_a

spec/mongoid/tree/traversal_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@
144144
Node.stub(:roots).and_return [@root1, @root2]
145145
end
146146

147-
it 'grabs each root' do
147+
it 'should grab each root' do
148148
Node.should_receive(:roots).and_return []
149149

150150
Node.traverse.should == []
151151
end
152152

153-
it 'defaults the "type" arg to :depth_first' do
153+
it 'should default the "type" arg to :depth_first' do
154154
@root1.should_receive(:traverse).with(:depth_first).and_return([])
155155
@root2.should_receive(:traverse).with(:depth_first).and_return([])
156156

157157
Node.traverse.should == []
158158
end
159159

160-
it 'traverses each root' do
160+
it 'should traverse each root' do
161161
@root1.should_receive(:traverse).and_return([1, 2])
162162
@root2.should_receive(:traverse).and_return([3, 4])
163163

@@ -166,7 +166,7 @@
166166

167167
describe 'when the "type" arg is :breadth_first' do
168168

169-
it 'traverses breadth-first' do
169+
it 'should traverse breadth-first' do
170170
@root1.should_receive(:traverse).with(:breadth_first).and_return([])
171171
@root2.should_receive(:traverse).with(:breadth_first).and_return([])
172172

spec/mongoid/tree_spec.rb

+21-11
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@
290290
end
291291
end
292292

293-
it "#ancestors_and_self should return the documents ancestors and itself" do
294-
node(:subchild).ancestors_and_self.to_a.should == [node(:root), node(:child), node(:subchild)]
293+
describe '#ancestors_and_self' do
294+
it "should return the documents ancestors and itself" do
295+
node(:subchild).ancestors_and_self.to_a.should == [node(:root), node(:child), node(:subchild)]
296+
end
295297
end
296298

297299
describe '#ancestor_of?' do
@@ -306,12 +308,16 @@
306308
end
307309

308310
describe 'descendants' do
309-
it "#descendants should return the documents descendants" do
310-
node(:root).descendants.to_a.should =~ [node(:child), node(:other_child), node(:subchild)]
311+
describe '#descendants' do
312+
it "should return the documents descendants" do
313+
node(:root).descendants.to_a.should =~ [node(:child), node(:other_child), node(:subchild)]
314+
end
311315
end
312316

313-
it "#descendants_and_self should return the documents descendants and itself" do
314-
node(:root).descendants_and_self.to_a.should =~ [node(:root), node(:child), node(:other_child), node(:subchild)]
317+
describe '#descendants_and_self' do
318+
it "should return the documents descendants and itself" do
319+
node(:root).descendants_and_self.to_a.should =~ [node(:root), node(:child), node(:other_child), node(:subchild)]
320+
end
315321
end
316322

317323
describe '#descendant_of?' do
@@ -328,13 +334,17 @@
328334
end
329335

330336
describe 'siblings' do
331-
it "#siblings should return the documents siblings" do
332-
node(:child).siblings.to_a.should == [node(:other_child)]
337+
describe '#siblings' do
338+
it "should return the documents siblings" do
339+
node(:child).siblings.to_a.should == [node(:other_child)]
340+
end
333341
end
334342

335-
it "#siblings_and_self should return the documents siblings and itself" do
336-
node(:child).siblings_and_self.should be_kind_of(Mongoid::Criteria)
337-
node(:child).siblings_and_self.to_a.should == [node(:child), node(:other_child)]
343+
describe '#siblings_and_self' do
344+
it "should return the documents siblings and itself" do
345+
node(:child).siblings_and_self.should be_kind_of(Mongoid::Criteria)
346+
node(:child).siblings_and_self.to_a.should == [node(:child), node(:other_child)]
347+
end
338348
end
339349

340350
describe '#sibling_of?' do

0 commit comments

Comments
 (0)