brightcontent-pages 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,23 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightcontent-pages (2.0.8)
4
+ brightcontent-pages (2.0.9)
5
5
  awesome_nested_set
6
- brightcontent-attachments (= 2.0.8)
7
- brightcontent-core (= 2.0.8)
6
+ brightcontent-attachments (= 2.0.9)
7
+ brightcontent-core (= 2.0.9)
8
8
 
9
9
  PATH
10
10
  remote: ../attachments
11
11
  specs:
12
- brightcontent-attachments (2.0.8)
13
- brightcontent-core (= 2.0.8)
12
+ brightcontent-attachments (2.0.9)
13
+ brightcontent-core (= 2.0.9)
14
14
  jquery-fileupload-rails
15
15
  paperclip
16
16
 
17
17
  PATH
18
18
  remote: ../core
19
19
  specs:
20
- brightcontent-core (2.0.8)
20
+ brightcontent-core (2.0.9)
21
21
  bcrypt-ruby
22
22
  bootstrap-wysihtml5-rails
23
23
  has_scope
@@ -20,6 +20,10 @@ module Brightcontent
20
20
  Brightcontent.page_attachment_styles
21
21
  end
22
22
 
23
+ def root_parent_children
24
+ root? ? children : ancestors.first.children
25
+ end
26
+
23
27
  private
24
28
 
25
29
  def update_slug
@@ -45,5 +45,29 @@ module Brightcontent
45
45
  it { should_not be_homepage }
46
46
  end
47
47
  end
48
+
49
+ describe "root_parent_children" do
50
+ it "returns the children if page is root element" do
51
+ root, child = build(:page), build(:page)
52
+ root.children << child
53
+ root.root_parent_children.should == [child]
54
+ end
55
+
56
+ it "returns the children of parent if page has parent" do
57
+ root, page, child = create(:page), create(:page), create(:page)
58
+ root.children << page
59
+ page.children << child
60
+ page.root_parent_children.should == [page]
61
+ end
62
+
63
+ it "returns the children of root parent if page has multiple parent" do
64
+ root1, root2, page = create(:page), create(:page), create(:page)
65
+ root1.children << root2
66
+ root2.children << page
67
+ page.root_parent_children.should == [root2]
68
+ end
69
+
70
+ end
71
+
48
72
  end
49
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: brightcontent-core
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.8
21
+ version: 2.0.9
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.0.8
29
+ version: 2.0.9
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: brightcontent-attachments
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.0.8
37
+ version: 2.0.9
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.8
45
+ version: 2.0.9
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: awesome_nested_set
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -225,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  segments:
227
227
  - 0
228
- hash: 472946396454552319
228
+ hash: -3252734718285165620
229
229
  required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  none: false
231
231
  requirements:
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  segments:
236
236
  - 0
237
- hash: 472946396454552319
237
+ hash: -3252734718285165620
238
238
  requirements: []
239
239
  rubyforge_project:
240
240
  rubygems_version: 1.8.24