alchemy_cms 2.2.rc6 → 2.2.rc7
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +0 -1
- data/.travis.yml +5 -4
- data/Gemfile +7 -8
- data/app/controllers/alchemy/admin/pages_controller.rb +1 -2
- data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
- data/app/controllers/alchemy/base_controller.rb +2 -1
- data/app/controllers/alchemy/pages_controller.rb +5 -5
- data/app/helpers/alchemy/admin/base_helper.rb +2 -0
- data/app/models/alchemy/attachment.rb +2 -1
- data/app/models/alchemy/element.rb +12 -16
- data/app/models/alchemy/page.rb +8 -4
- data/config/locales/alchemy.en.yml +1 -1
- data/db/migrate/20101216151419_add_language_id_to_pages.rb +11 -3
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +2 -2
- data/spec/controllers/admin/clipboard_controller_spec.rb +12 -12
- data/spec/controllers/admin/contents_controller_spec.rb +3 -3
- data/spec/controllers/admin/elements_controller_spec.rb +1 -1
- data/spec/controllers/admin/languages_controller_spec.rb +1 -1
- data/spec/controllers/admin/pages_controller_spec.rb +33 -1
- data/spec/controllers/admin/trash_controller_spec.rb +3 -3
- data/spec/controllers/base_controller_spec.rb +3 -3
- data/spec/controllers/pages_controller_spec.rb +6 -6
- data/spec/dummy/config/database.yml +24 -18
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/factories.rb +5 -5
- data/spec/helpers/admin/contents_helper_spec.rb +1 -1
- data/spec/helpers/admin/elements_helper_spec.rb +2 -2
- data/spec/helpers/admin/essences_helper_spec.rb +1 -1
- data/spec/helpers/elements_helper_spec.rb +35 -35
- data/spec/helpers/essences_helper_spec.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +27 -27
- data/spec/integration/admin/modules_integration_spec.rb +30 -0
- data/spec/integration/admin/pages_controller_spec.rb +7 -7
- data/spec/integration/pages_controller_spec.rb +38 -24
- data/spec/integration/security_spec.rb +1 -1
- data/spec/models/content_spec.rb +5 -5
- data/spec/models/element_spec.rb +59 -14
- data/spec/models/language_spec.rb +9 -9
- data/spec/models/page_spec.rb +66 -42
- data/spec/models/user_spec.rb +1 -1
- data/spec/page_layout_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/alchemy/specs_helpers.rb +1 -1
- metadata +36 -34
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/integration_spec_helper'
|
3
|
+
|
4
|
+
describe "Modules" do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
FactoryGirl.build(:admin_user).save_without_session_maintenance
|
8
|
+
end
|
9
|
+
describe "a custom module with a main-apps controller" do
|
10
|
+
it "should have a button in main_navigation, pointing to the configured controller" do
|
11
|
+
Alchemy::Modules.register_module(
|
12
|
+
{
|
13
|
+
:name => 'events',
|
14
|
+
:navigation => {
|
15
|
+
:icon => 'icon events',
|
16
|
+
:name => 'Events',
|
17
|
+
:controller => '/admin/events',
|
18
|
+
:action => 'index'
|
19
|
+
}
|
20
|
+
})
|
21
|
+
login_into_alchemy
|
22
|
+
without_access_control do
|
23
|
+
visit '/alchemy/admin'
|
24
|
+
click_on 'Events'
|
25
|
+
page.should_not have_content('Upps!')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -10,10 +10,10 @@ unless ENV["CI"]
|
|
10
10
|
context "in a multilangual environment" do
|
11
11
|
|
12
12
|
before(:all) do
|
13
|
-
|
14
|
-
@language =
|
15
|
-
@german_root =
|
16
|
-
@klingonian_root =
|
13
|
+
FactoryGirl.build(:admin_user).save_without_session_maintenance
|
14
|
+
@language = FactoryGirl.create(:language)
|
15
|
+
@german_root = FactoryGirl.create(:language_root_page, :language => Alchemy::Language.get_default, :name => 'Deutsch')
|
16
|
+
@klingonian_root = FactoryGirl.create(:language_root_page, :name => 'Klingonian')
|
17
17
|
end
|
18
18
|
|
19
19
|
it "one should be able to switch the language tree" do
|
@@ -34,8 +34,8 @@ unless ENV["CI"]
|
|
34
34
|
context "with no language root page" do
|
35
35
|
|
36
36
|
before(:all) do
|
37
|
-
|
38
|
-
@language =
|
37
|
+
FactoryGirl.build(:admin_user).save_without_session_maintenance
|
38
|
+
@language = FactoryGirl.create(:language)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "it should display the form for creating language root" do
|
@@ -56,7 +56,7 @@ unless ENV["CI"]
|
|
56
56
|
describe "flush complete page cache" do
|
57
57
|
|
58
58
|
before(:all) do
|
59
|
-
|
59
|
+
FactoryGirl.build(:admin_user).save_without_session_maintenance
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should remove the cache of all pages" do
|
@@ -1,26 +1,27 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Alchemy::PagesController do
|
4
5
|
|
5
6
|
before(:each) do
|
6
7
|
@default_language = Alchemy::Language.get_default
|
7
|
-
@default_language_root =
|
8
|
+
@default_language_root = FactoryGirl.create(:language_root_page, :language => @default_language, :name => 'Home')
|
8
9
|
end
|
9
10
|
|
10
11
|
describe "#show" do
|
11
12
|
|
12
13
|
it "should include all its elements and contents" do
|
13
|
-
p =
|
14
|
+
p = FactoryGirl.create(:public_page, :language => @default_language)
|
14
15
|
article = p.elements.find_by_name('article')
|
15
16
|
article.content_by_name('intro').essence.update_attributes(:body => 'Welcome to Peters Petshop', :public => true)
|
16
|
-
visit
|
17
|
+
visit "/alchemy/#{p.urlname}"
|
17
18
|
within('div#content div.article div.intro') { page.should have_content('Welcome to Peters Petshop') }
|
18
19
|
end
|
19
20
|
|
20
21
|
it "should show the navigation with all visible pages" do
|
21
22
|
pages = [
|
22
|
-
|
23
|
-
|
23
|
+
FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id),
|
24
|
+
FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 2', :parent_id => @default_language_root.id)
|
24
25
|
]
|
25
26
|
visit '/alchemy/'
|
26
27
|
within('div#navigation ul') { page.should have_selector('li a[href="/alchemy/page-1"], li a[href="/alchemy/page-2"]') }
|
@@ -31,9 +32,9 @@ describe Alchemy::PagesController do
|
|
31
32
|
describe "fulltext search" do
|
32
33
|
|
33
34
|
before(:each) do
|
34
|
-
@page =
|
35
|
-
@element =
|
36
|
-
|
35
|
+
@page = FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id)
|
36
|
+
@element = FactoryGirl.create(:element, :name => 'article', :page => @page)
|
37
|
+
FactoryGirl.create(:public_page, :language => @default_language, :name => 'Suche', :page_layout => 'search', :parent_id => @default_language_root.id)
|
37
38
|
end
|
38
39
|
|
39
40
|
it "should have a correct path in the form tag" do
|
@@ -85,20 +86,20 @@ describe Alchemy::PagesController do
|
|
85
86
|
context "in multi language mode" do
|
86
87
|
|
87
88
|
before(:each) do
|
88
|
-
@page =
|
89
|
+
@page = FactoryGirl.create(:public_page)
|
89
90
|
Alchemy::Config.stub!(:get) { |arg| arg == :url_nesting ? true : Alchemy::Config.parameter(arg) }
|
90
91
|
end
|
91
92
|
|
92
|
-
it "should redirect to url with nested language code" do
|
93
|
-
visit
|
94
|
-
page.current_path.should ==
|
93
|
+
it "should redirect to url with nested language code if no language params are given" do
|
94
|
+
visit "/alchemy/#{@page.urlname}"
|
95
|
+
page.current_path.should == "/alchemy/#{@page.language_code}/#{@page.urlname}"
|
95
96
|
end
|
96
97
|
|
97
98
|
context "should redirect to public child" do
|
98
99
|
|
99
100
|
before(:each) do
|
100
101
|
@page.update_attributes(:public => false, :name => 'Not Public', :urlname => '')
|
101
|
-
@child =
|
102
|
+
@child = FactoryGirl.create(:public_page, :name => 'Public Child', :parent_id => @page.id)
|
102
103
|
Alchemy::Config.stub!(:get) { |arg| arg == :url_nesting ? false : Alchemy::Config.parameter(arg) }
|
103
104
|
end
|
104
105
|
|
@@ -114,27 +115,40 @@ describe Alchemy::PagesController do
|
|
114
115
|
|
115
116
|
end
|
116
117
|
|
117
|
-
it "should redirect to pages url, if requested url is index url" do
|
118
|
+
it "should redirect to pages url with default language, if requested url is index url" do
|
118
119
|
visit '/alchemy/'
|
119
120
|
page.current_path.should == '/alchemy/de/home'
|
120
121
|
end
|
121
122
|
|
122
|
-
it "should redirect to pages url, if requested url is only the language code" do
|
123
|
+
it "should redirect to pages url with default language, if requested url is only the language code" do
|
123
124
|
visit '/alchemy/de'
|
124
125
|
page.current_path.should == '/alchemy/de/home'
|
125
126
|
end
|
126
127
|
|
128
|
+
context "requested url is only the urlname" do
|
129
|
+
it "then it should redirect to pages url with nested language." do
|
130
|
+
visit '/alchemy/home'
|
131
|
+
page.current_path.should == '/alchemy/de/home'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
127
135
|
it "should keep additional params" do
|
128
|
-
visit
|
136
|
+
visit "/alchemy/#{@page.urlname}?query=Peter"
|
129
137
|
page.current_url.should match(/\?query=Peter/)
|
130
138
|
end
|
131
139
|
|
140
|
+
it "should render 404 if urlname and lang parameter do not belong to same page" do
|
141
|
+
Alchemy::User.stub!(:admins).and_return(OpenStruct.new(:count => 2))
|
142
|
+
visit "/alchemy/en/#{@page.urlname}"
|
143
|
+
page.status_code.should == 404
|
144
|
+
end
|
145
|
+
|
132
146
|
context "with url nesting" do
|
133
147
|
|
134
148
|
before(:each) do
|
135
|
-
@level1 =
|
136
|
-
@level2 =
|
137
|
-
@level3 =
|
149
|
+
@level1 = FactoryGirl.create(:public_page, :parent_id => @default_language_root.id, :name => 'catalog', :language => @default_language)
|
150
|
+
@level2 = FactoryGirl.create(:public_page, :parent_id => @level1.id, :name => 'products', :language => @default_language)
|
151
|
+
@level3 = FactoryGirl.create(:public_page, :parent_id => @level2.id, :name => 'screwdriver', :language => @default_language)
|
138
152
|
end
|
139
153
|
|
140
154
|
context "enabled" do
|
@@ -184,13 +198,13 @@ describe Alchemy::PagesController do
|
|
184
198
|
context "not in multi language mode" do
|
185
199
|
|
186
200
|
before(:each) do
|
187
|
-
@page =
|
201
|
+
@page = FactoryGirl.create(:public_page, :language => @default_language, :parent_id => @default_language_root.id)
|
188
202
|
Alchemy::Config.stub!(:get) { |arg| arg == :url_nesting ? false : Alchemy::Config.parameter(arg) }
|
189
203
|
end
|
190
204
|
|
191
205
|
it "should redirect from nested language code url to normal url" do
|
192
|
-
visit
|
193
|
-
page.current_path.should ==
|
206
|
+
visit "/alchemy/de/#{@page.urlname}"
|
207
|
+
page.current_path.should == "/alchemy/#{@page.urlname}"
|
194
208
|
end
|
195
209
|
|
196
210
|
context "with no lang parameter" do
|
@@ -211,7 +225,7 @@ describe Alchemy::PagesController do
|
|
211
225
|
|
212
226
|
before(:each) do
|
213
227
|
@page.update_attributes(:public => false, :name => 'Not Public', :urlname => '')
|
214
|
-
@child =
|
228
|
+
@child = FactoryGirl.create(:public_page, :name => 'Public Child', :parent_id => @page.id, :language => @default_language)
|
215
229
|
end
|
216
230
|
|
217
231
|
it "if requested page is unpublished" do
|
@@ -232,7 +246,7 @@ describe Alchemy::PagesController do
|
|
232
246
|
end
|
233
247
|
|
234
248
|
it "should keep additional params" do
|
235
|
-
visit
|
249
|
+
visit "/alchemy/de/#{@page.urlname}?query=Peter"
|
236
250
|
page.current_url.should match(/\?query=Peter/)
|
237
251
|
end
|
238
252
|
|
@@ -19,7 +19,7 @@ describe "Security: " do
|
|
19
19
|
context "If user is present" do
|
20
20
|
|
21
21
|
before(:all) do
|
22
|
-
|
22
|
+
FactoryGirl.build(:admin_user).save_without_session_maintenance
|
23
23
|
end
|
24
24
|
|
25
25
|
it "a visitor should not be able to signup" do
|
data/spec/models/content_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Alchemy::Content do
|
4
4
|
|
5
5
|
it "should return the ingredient from its essence" do
|
6
|
-
@element =
|
6
|
+
@element = FactoryGirl.create(:element, :name => 'headline')
|
7
7
|
@content = @element.contents.find_by_essence_type('Alchemy::EssenceText')
|
8
8
|
@content.essence.update_attributes(:body => "Hello")
|
9
9
|
@content.ingredient.should == "Hello"
|
@@ -52,21 +52,21 @@ describe Alchemy::Content do
|
|
52
52
|
describe '#update_essence' do
|
53
53
|
|
54
54
|
it "should update the attributes of related essence and return true" do
|
55
|
-
@element =
|
55
|
+
@element = FactoryGirl.create(:element, :name => 'text')
|
56
56
|
@content = @element.contents.first
|
57
57
|
@content.update_essence(:body => 'Mikes Petshop')
|
58
58
|
@content.ingredient.should == "Mikes Petshop"
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should add error messages if save fails and return false" do
|
62
|
-
@element =
|
62
|
+
@element = FactoryGirl.create(:element, :name => 'contactform')
|
63
63
|
@content = @element.contents.first
|
64
64
|
@content.update_essence
|
65
65
|
@content.errors[:essence].should have(1).item
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should raise error if essence is missing" do
|
69
|
-
@element =
|
69
|
+
@element = FactoryGirl.create(:element, :name => 'text')
|
70
70
|
@content = @element.contents.first
|
71
71
|
@content.update_essence
|
72
72
|
end
|
@@ -76,7 +76,7 @@ describe Alchemy::Content do
|
|
76
76
|
describe '#copy' do
|
77
77
|
|
78
78
|
before(:each) do
|
79
|
-
@element =
|
79
|
+
@element = FactoryGirl.create(:element, :name => 'text')
|
80
80
|
@content = @element.contents.first
|
81
81
|
end
|
82
82
|
|
data/spec/models/element_spec.rb
CHANGED
@@ -9,26 +9,26 @@ describe Alchemy::Element do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should return all public elements" do
|
12
|
-
elements = [
|
12
|
+
elements = [FactoryGirl.create(:element, :public => true), FactoryGirl.create(:element, :public => true)]
|
13
13
|
Alchemy::Element.published.all.should == elements
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should return all elements by name" do
|
17
|
-
elements = [
|
17
|
+
elements = [FactoryGirl.create(:element, :name => 'article'), FactoryGirl.create(:element, :name => 'article')]
|
18
18
|
Alchemy::Element.named(['article']).all.should == elements
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should return all elements but excluded ones" do
|
22
|
-
|
23
|
-
|
24
|
-
excluded = [
|
22
|
+
FactoryGirl.create(:element, :name => 'article')
|
23
|
+
FactoryGirl.create(:element, :name => 'article')
|
24
|
+
excluded = [FactoryGirl.create(:element, :name => 'claim')]
|
25
25
|
Alchemy::Element.excluded(['article']).all.should == excluded
|
26
26
|
end
|
27
27
|
|
28
28
|
context "not_in_cell" do
|
29
29
|
it "should return all elements that are not in a cell" do
|
30
|
-
|
31
|
-
|
30
|
+
FactoryGirl.create(:element, :cell_id => 6)
|
31
|
+
FactoryGirl.create(:element, :cell_id => nil)
|
32
32
|
Alchemy::Element.not_in_cell.should have(1).element
|
33
33
|
end
|
34
34
|
end
|
@@ -55,7 +55,7 @@ describe Alchemy::Element do
|
|
55
55
|
context "retrieving contents, essences and ingredients" do
|
56
56
|
|
57
57
|
before(:each) do
|
58
|
-
@element =
|
58
|
+
@element = FactoryGirl.create(:element, :name => 'news')
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should return an ingredient by name" do
|
@@ -73,11 +73,16 @@ describe Alchemy::Element do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should return a collection of trashed elements" do
|
76
|
-
@element =
|
76
|
+
@element = FactoryGirl.create(:element)
|
77
77
|
@element.trash
|
78
78
|
Alchemy::Element.trashed.should include(@element)
|
79
79
|
end
|
80
80
|
|
81
|
+
it "should return a collection of not trashed elements" do
|
82
|
+
@element = FactoryGirl.create(:element, :page_id => 1)
|
83
|
+
Alchemy::Element.not_trashed.should include(@element)
|
84
|
+
end
|
85
|
+
|
81
86
|
context "limited amount" do
|
82
87
|
before(:each) do
|
83
88
|
descriptions = Alchemy::Element.descriptions
|
@@ -98,7 +103,7 @@ describe Alchemy::Element do
|
|
98
103
|
'elements' => ['column_headline', 'unique_headline'],
|
99
104
|
'autogenerate' => ['unique_headline', 'column_headline', 'column_headline', 'column_headline']
|
100
105
|
)
|
101
|
-
@page =
|
106
|
+
@page = FactoryGirl.create(:page, :page_layout => 'columns')
|
102
107
|
end
|
103
108
|
|
104
109
|
it "should be readable" do
|
@@ -119,7 +124,7 @@ describe Alchemy::Element do
|
|
119
124
|
context "trashed" do
|
120
125
|
|
121
126
|
before(:each) do
|
122
|
-
@element =
|
127
|
+
@element = FactoryGirl.create(:element)
|
123
128
|
@element.trash
|
124
129
|
end
|
125
130
|
|
@@ -144,7 +149,7 @@ describe Alchemy::Element do
|
|
144
149
|
describe "#content_by_type" do
|
145
150
|
|
146
151
|
before(:each) do
|
147
|
-
@element =
|
152
|
+
@element = FactoryGirl.create(:element, :name => 'headline')
|
148
153
|
@content = @element.contents.first
|
149
154
|
end
|
150
155
|
|
@@ -169,7 +174,7 @@ describe Alchemy::Element do
|
|
169
174
|
describe "#all_contents_by_type" do
|
170
175
|
|
171
176
|
before(:each) do
|
172
|
-
@element =
|
177
|
+
@element = FactoryGirl.create(:element)
|
173
178
|
@contents = @element.contents.select { |c| c.essence_type == 'Alchemy::EssenceText' }
|
174
179
|
end
|
175
180
|
|
@@ -194,7 +199,7 @@ describe Alchemy::Element do
|
|
194
199
|
describe '#copy' do
|
195
200
|
|
196
201
|
before(:each) do
|
197
|
-
@element =
|
202
|
+
@element = FactoryGirl.create(:element)
|
198
203
|
end
|
199
204
|
|
200
205
|
it "should not create contents from scratch" do
|
@@ -214,4 +219,44 @@ describe Alchemy::Element do
|
|
214
219
|
|
215
220
|
end
|
216
221
|
|
222
|
+
describe "Finding previous or next element." do
|
223
|
+
|
224
|
+
before(:each) do
|
225
|
+
@page = FactoryGirl.create(:language_root_page)
|
226
|
+
@page.elements.delete_all
|
227
|
+
@element1 = FactoryGirl.create(:element, :page => @page, :name => 'headline')
|
228
|
+
@element2 = FactoryGirl.create(:element, :page => @page)
|
229
|
+
@element3 = FactoryGirl.create(:element, :page => @page, :name => 'text')
|
230
|
+
end
|
231
|
+
|
232
|
+
describe '#prev' do
|
233
|
+
|
234
|
+
it "should return previous element on same page" do
|
235
|
+
@element2.prev.should == @element1
|
236
|
+
end
|
237
|
+
|
238
|
+
context "with name as parameter" do
|
239
|
+
it "should return previous of this kind" do
|
240
|
+
@element3.prev('headline').should == @element1
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
describe '#next' do
|
247
|
+
|
248
|
+
it "should return next element on same page" do
|
249
|
+
@element1.next.should == @element2
|
250
|
+
end
|
251
|
+
|
252
|
+
context "with name as parameter" do
|
253
|
+
it "should return next of this kind" do
|
254
|
+
@element1.next('text').should == @element3
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
|
217
262
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
describe Alchemy::Language do
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
@language =
|
7
|
+
@language = FactoryGirl.create(:language)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should return a label for code" do
|
@@ -30,7 +30,7 @@ describe Alchemy::Language do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should update all associated Pages with self.code as value for Page#language_code" do
|
33
|
-
@page =
|
33
|
+
@page = FactoryGirl.create(:page, :language => @language)
|
34
34
|
@language.country_code = 'cr'
|
35
35
|
@language.save
|
36
36
|
@page.reload; @page.language_code.should == 'kl-cr'
|
@@ -43,8 +43,8 @@ describe Alchemy::Language do
|
|
43
43
|
|
44
44
|
context "removing the country_code" do
|
45
45
|
it "should update all associated Pages´s language_code with Language#code" do
|
46
|
-
language =
|
47
|
-
@page =
|
46
|
+
language = FactoryGirl.create(:language_with_country_code)
|
47
|
+
@page = FactoryGirl.create(:page, :language => language)
|
48
48
|
language.country_code = ''
|
49
49
|
language.save
|
50
50
|
@page.reload; @page.language_code.should == "kl"
|
@@ -56,7 +56,7 @@ describe Alchemy::Language do
|
|
56
56
|
it "should not be deletable if it is the default language" do
|
57
57
|
@default_language = Alchemy::Language.find_by_default(true)
|
58
58
|
if !@default_language
|
59
|
-
@default_language =
|
59
|
+
@default_language = FactoryGirl.create(:language, :name => "default", :code => "aa", :frontpage_name => "intro", :default => true)
|
60
60
|
end
|
61
61
|
expect { @default_language.destroy }.should raise_error
|
62
62
|
end
|
@@ -75,8 +75,8 @@ describe Alchemy::Language do
|
|
75
75
|
context "after_update" do
|
76
76
|
describe "#set_pages_language if language´s code has changed" do
|
77
77
|
it "should update all its pages with the new code" do
|
78
|
-
@page =
|
79
|
-
@other_page =
|
78
|
+
@page = FactoryGirl.create(:page, :language => @language)
|
79
|
+
@other_page = FactoryGirl.create(:page, :language => @language)
|
80
80
|
@language.update_attributes(:code => "fo")
|
81
81
|
@language.reload; @page.reload; @other_page.reload
|
82
82
|
[@page.language_code, @other_page.language_code].should == [@language.code, @language.code]
|
@@ -84,8 +84,8 @@ describe Alchemy::Language do
|
|
84
84
|
end
|
85
85
|
describe "#unpublish_pages" do
|
86
86
|
it "should set all pages to unpublic if it gets set to unpublic" do
|
87
|
-
@page =
|
88
|
-
@other_page =
|
87
|
+
@page = FactoryGirl.create(:page, :language => @language)
|
88
|
+
@other_page = FactoryGirl.create(:page, :language => @language)
|
89
89
|
@language.update_attributes(:public => false)
|
90
90
|
@language.reload; @page.reload; @other_page.reload
|
91
91
|
[@page.public?, @other_page.public?].should == [false, false]
|