refinerycms-pages 0.9.9.18 → 0.9.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-pages}
5
- s.version = %q{0.9.9.18}
5
+ s.version = %q{0.9.9.19}
6
6
  s.summary = %q{Pages engine for Refinery CMS}
7
7
  s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
8
- s.date = %q{2011-04-16}
8
+ s.date = %q{2011-04-22}
9
9
  s.email = %q{info@refinerycms.com}
10
10
  s.homepage = %q{http://refinerycms.com}
11
11
  s.rubyforge_project = %q{refinerycms}
@@ -117,6 +117,6 @@ Gem::Specification.new do |s|
117
117
  'spec/models/page_spec.rb'
118
118
  ]
119
119
 
120
- s.add_dependency 'refinerycms-core', '= 0.9.9.18'
120
+ s.add_dependency 'refinerycms-core', '= 0.9.9.19'
121
121
  s.add_dependency 'seo_meta', '~> 1.0.4'
122
122
  end
@@ -2,32 +2,16 @@ require 'spec_helper'
2
2
 
3
3
  describe Page do
4
4
 
5
- def reset_page(options = {})
6
- if @page
7
- @page.destroy!
8
- @page.children.each(&:destroy!)
9
- @page = nil
10
- @child = nil
11
- end
12
-
13
- @page = Page.create!({
14
- :id => 1,
5
+ let(:page) do
6
+ Page.create!({
15
7
  :title => "RSpec is great for testing too",
16
8
  :deletable => true
17
- }.update(options))
9
+ })
18
10
  end
11
+ let(:child) { page.children.create(:title => 'The child page') }
19
12
 
20
13
  def page_cannot_be_destroyed
21
- @page.destroy.should == false
22
- end
23
-
24
- def create_child
25
- @child = @page.children.create(:title => 'The child page')
26
- end
27
-
28
- def create_page_parts
29
- @page.parts.create(:title => 'body', :content => "I'm the first page part for this page.")
30
- @page.parts.create(:title => 'side body', :content => "Closely followed by the second page part.")
14
+ page.destroy.should == false
31
15
  end
32
16
 
33
17
  def turn_off_marketable_urls
@@ -38,144 +22,144 @@ describe Page do
38
22
  RefinerySetting.set(:use_marketable_urls, {:value => true, :scoping => 'pages'})
39
23
  end
40
24
 
41
- before(:each) do
42
- reset_page
25
+ def create_page_parts
26
+ page.parts.create(:title => 'body', :content => "I'm the first page part for this page.")
27
+ page.parts.create(:title => 'side body', :content => "Closely followed by the second page part.")
43
28
  end
44
29
 
45
30
  context "cannot be deleted under certain rules" do
46
31
  it "if link_url is present" do
47
- reset_page({:link_url => '/plugin-name'})
32
+ page.link_url = '/plugin-name'
48
33
  page_cannot_be_destroyed
49
34
  end
50
35
 
51
36
 
52
37
  it "if refinery team deems it so" do
53
- reset_page({:deletable => false})
38
+ page.deletable = false
54
39
  page_cannot_be_destroyed
55
40
  end
56
41
 
57
42
  it "if menu_match is present" do
58
- reset_page({:menu_match => '^/RSpec is great for testing too.*$'})
43
+ page.menu_match = '^/RSpec is great for testing too.*$'
59
44
  page_cannot_be_destroyed
60
45
  end
61
46
 
62
47
  it "unless you really want it to! >:]" do
63
- reset_page
64
- @page.destroy!
48
+ page.destroy.should be
65
49
  end
66
50
  end
67
51
 
68
52
  context "page urls" do
69
53
 
70
54
  it "should return a full path" do
71
- @page.path.should == 'RSpec is great for testing too'
55
+ page.path.should == 'RSpec is great for testing too'
72
56
  end
73
57
 
74
58
  it "and all of its parent page titles, reversed" do
75
- create_child
76
- @child.path.should == 'RSpec is great for testing too - The child page'
59
+ child.path.should == 'RSpec is great for testing too - The child page'
77
60
  end
78
61
 
79
62
  it "or normally ;-)" do
80
- create_child
81
- @child.path({:reversed => false}).should == 'The child page - RSpec is great for testing too'
63
+ child.path({:reversed => false}).should == 'The child page - RSpec is great for testing too'
82
64
  end
83
65
 
84
66
  it "should return its url" do
85
- @page.link_url = '/contact'
86
- @page.url.should == '/contact'
67
+ page.link_url = '/contact'
68
+ page.url.should == '/contact'
87
69
  end
88
70
 
89
71
  it "should return its path with marketable urls" do
90
- @page.url[:id].should be_nil
91
- @page.url[:path].should == ["rspec-is-great-for-testing-too"]
72
+ page.url[:id].should be_nil
73
+ page.url[:path].should == ["rspec-is-great-for-testing-too"]
92
74
  end
93
75
 
94
76
  it "should return its path underneath its parent with marketable urls" do
95
- create_child
96
- @child.url[:id].should be_nil
97
- @child.url[:path].should == [@page.url[:path].first, 'the-child-page']
77
+ child.url[:id].should be_nil
78
+ child.url[:path].should == [page.url[:path].first, 'the-child-page']
98
79
  end
99
80
 
100
81
  it "should not have a path without marketable urls" do
101
82
  turn_off_marketable_urls
102
- @page.url[:path].should be_nil
103
- @page.url[:id].should == "rspec-is-great-for-testing-too"
83
+ page.url[:path].should be_nil
84
+ page.url[:id].should == "rspec-is-great-for-testing-too"
104
85
  turn_on_marketable_urls
105
86
  end
106
87
 
107
88
  it "should not mention its parent without marketable urls" do
108
89
  turn_off_marketable_urls
109
- create_child
110
- @child.url[:id].should == 'the-child-page'
111
- @child.url[:path].should be_nil
90
+ child.url[:id].should == 'the-child-page'
91
+ child.url[:path].should be_nil
112
92
  turn_on_marketable_urls
113
93
  end
114
94
  end
115
95
 
116
96
  context "home page" do
117
97
  it "should respond as the home page" do
118
- @page.link_url = '/'
119
- @page.home?.should == true
98
+ page.link_url = '/'
99
+ page.home?.should == true
120
100
  end
121
101
 
122
102
  it "should not respond as the home page" do
123
- @page.home?.should == false
103
+ page.home?.should == false
124
104
  end
125
105
  end
126
106
 
127
107
  context "content sections (page parts)" do
128
- it "should return the content when using []" do
129
- create_page_parts
108
+ before { create_page_parts }
130
109
 
131
- @page[:body].should == "<p>I'm the first page part for this page.</p>"
132
- @page["BoDY"].should == "<p>I'm the first page part for this page.</p>"
110
+ it "should return the content when using []" do
111
+ page[:body].should == "<p>I'm the first page part for this page.</p>"
112
+ page["BoDY"].should == "<p>I'm the first page part for this page.</p>"
133
113
  end
134
114
 
135
115
  it "should return all page part content" do
136
- create_page_parts
137
-
138
- @page.all_page_part_content.should == "<p>I'm the first page part for this page.</p> <p>Closely followed by the second page part.</p>"
116
+ page.all_page_part_content.should == "<p>I'm the first page part for this page.</p> <p>Closely followed by the second page part.</p>"
139
117
  end
140
118
 
141
119
  it "should reposition correctly" do
142
- create_page_parts
143
- @page.parts.first.position = 6
144
- @page.parts.last.position = 4
120
+ page.parts.first.position = 6
121
+ page.parts.last.position = 4
145
122
 
146
- @page.parts.first.position.should == 6
147
- @page.parts.last.position.should == 4
123
+ page.parts.first.position.should == 6
124
+ page.parts.last.position.should == 4
148
125
 
149
- @page.reposition_parts!
126
+ page.reposition_parts!
150
127
 
151
- @page.parts.first.position.should == 0
152
- @page.parts.last.position.should == 1
128
+ page.parts.first.position.should == 0
129
+ page.parts.last.position.should == 1
153
130
  end
154
131
  end
155
132
 
156
133
  context "draft pages" do
157
134
  it "should not be a live page when set to draft" do
158
- @page.draft = true
159
- @page.live?.should == false
135
+ page.draft = true
136
+ page.live?.should_not be
137
+ end
160
138
 
161
- @page.draft = false
162
- @page.live?.should == true
139
+ it "should be a live page when not set to draft" do
140
+ page.draft = false
141
+ page.live?.should be
163
142
  end
164
143
  end
165
144
 
166
145
  context "should add url suffix" do
167
- before(:each) do
168
- turn_on_marketable_urls
169
- @reserved_word = Page.friendly_id_config.reserved_words.last
170
- reset_page(:title => @reserved_word)
146
+ let(:reserved_word) { Page.friendly_id_config.reserved_words.last }
147
+ let(:page_with_reserved_title) do
148
+ Page.create!({
149
+ :title => reserved_word,
150
+ :deletable => true
151
+ })
171
152
  end
172
153
 
154
+ before { turn_on_marketable_urls }
155
+
173
156
  it "when title is set to a reserved word" do
174
- @page.url[:path].should == ["#{@reserved_word}-page"]
157
+ page_with_reserved_title.url[:path].should == ["#{reserved_word}-page"]
175
158
  end
176
159
 
177
160
  it "when parent page title is set to a reserved word" do
178
- create_child.url[:path].should == ["#{@reserved_word}-page", 'the-child-page']
161
+ child = page_with_reserved_title.children.create(:title => 'The child page')
162
+ child.url[:path].should == ["#{reserved_word}-page", 'the-child-page']
179
163
  end
180
164
  end
181
165
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-pages
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.18
5
+ version: 0.9.9.19
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-04-16 00:00:00 Z
16
+ date: 2011-04-22 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: refinerycms-core
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.9.18
26
+ version: 0.9.9.19
27
27
  type: :runtime
28
28
  version_requirements: *id001
29
29
  - !ruby/object:Gem::Dependency