noodall-core 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/noodall/node.rb CHANGED
@@ -288,7 +288,7 @@ module Noodall
288
288
  end
289
289
 
290
290
  def roots(options = {})
291
- self.where(parent_id_field => self._id).order(tree_order)
291
+ self.where(parent_id_field => nil).order(tree_order)
292
292
  end
293
293
 
294
294
  def find_by_permalink(permalink)
data/noodall-core.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{noodall-core}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve England"]
data/spec/node_spec.rb CHANGED
@@ -58,6 +58,21 @@ describe Noodall::Node do
58
58
  @grandchild = Page.create!(:title => "Very Ickle Kid", :parent => @child)
59
59
  end
60
60
 
61
+ it "should list the roots" do
62
+ Page.create!(:title => "Root 2")
63
+
64
+ Noodall::Node.roots.should have(2).things
65
+ end
66
+
67
+ it "should know about it's siblings" do
68
+ 3.times do |i|
69
+ Page.create!(:title => "Sibbling #{i}", :parent => @root)
70
+ end
71
+
72
+ @child.siblings.should have(3).things
73
+ @child.self_and_siblings.should have(4).things
74
+ end
75
+
61
76
  it "should create permlink based on tree" do
62
77
  @grandchild.permalink.to_s.should == "root/ickle-kid/very-ickle-kid"
63
78
  @grandchild.reload
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England