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.
Files changed (45) hide show
  1. data/.rspec +0 -1
  2. data/.travis.yml +5 -4
  3. data/Gemfile +7 -8
  4. data/app/controllers/alchemy/admin/pages_controller.rb +1 -2
  5. data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
  6. data/app/controllers/alchemy/base_controller.rb +2 -1
  7. data/app/controllers/alchemy/pages_controller.rb +5 -5
  8. data/app/helpers/alchemy/admin/base_helper.rb +2 -0
  9. data/app/models/alchemy/attachment.rb +2 -1
  10. data/app/models/alchemy/element.rb +12 -16
  11. data/app/models/alchemy/page.rb +8 -4
  12. data/config/locales/alchemy.en.yml +1 -1
  13. data/db/migrate/20101216151419_add_language_id_to_pages.rb +11 -3
  14. data/lib/alchemy/version.rb +1 -1
  15. data/lib/alchemy_cms.rb +2 -2
  16. data/spec/controllers/admin/clipboard_controller_spec.rb +12 -12
  17. data/spec/controllers/admin/contents_controller_spec.rb +3 -3
  18. data/spec/controllers/admin/elements_controller_spec.rb +1 -1
  19. data/spec/controllers/admin/languages_controller_spec.rb +1 -1
  20. data/spec/controllers/admin/pages_controller_spec.rb +33 -1
  21. data/spec/controllers/admin/trash_controller_spec.rb +3 -3
  22. data/spec/controllers/base_controller_spec.rb +3 -3
  23. data/spec/controllers/pages_controller_spec.rb +6 -6
  24. data/spec/dummy/config/database.yml +24 -18
  25. data/spec/dummy/db/schema.rb +1 -1
  26. data/spec/factories.rb +5 -5
  27. data/spec/helpers/admin/contents_helper_spec.rb +1 -1
  28. data/spec/helpers/admin/elements_helper_spec.rb +2 -2
  29. data/spec/helpers/admin/essences_helper_spec.rb +1 -1
  30. data/spec/helpers/elements_helper_spec.rb +35 -35
  31. data/spec/helpers/essences_helper_spec.rb +1 -1
  32. data/spec/helpers/pages_helper_spec.rb +27 -27
  33. data/spec/integration/admin/modules_integration_spec.rb +30 -0
  34. data/spec/integration/admin/pages_controller_spec.rb +7 -7
  35. data/spec/integration/pages_controller_spec.rb +38 -24
  36. data/spec/integration/security_spec.rb +1 -1
  37. data/spec/models/content_spec.rb +5 -5
  38. data/spec/models/element_spec.rb +59 -14
  39. data/spec/models/language_spec.rb +9 -9
  40. data/spec/models/page_spec.rb +66 -42
  41. data/spec/models/user_spec.rb +1 -1
  42. data/spec/page_layout_spec.rb +1 -1
  43. data/spec/spec_helper.rb +2 -2
  44. data/spec/support/alchemy/specs_helpers.rb +1 -1
  45. metadata +36 -34
@@ -6,13 +6,13 @@ describe Alchemy::PagesController do
6
6
 
7
7
  before(:each) do
8
8
  @default_language = Alchemy::Language.get_default
9
- @default_language_root = Factory(:language_root_page, :language => @default_language, :name => 'Home', :public => true)
9
+ @default_language_root = FactoryGirl.create(:language_root_page, :language => @default_language, :name => 'Home', :public => true)
10
10
  end
11
11
 
12
12
  context "requested for a page containing a feed" do
13
13
 
14
14
  before(:each) do
15
- @page = Factory(:public_page, :parent_id => @default_language_root.id, :page_layout => 'news', :name => 'News', :language => @default_language)
15
+ @page = FactoryGirl.create(:public_page, :parent_id => @default_language_root.id, :page_layout => 'news', :name => 'News', :language => @default_language)
16
16
  end
17
17
 
18
18
  it "should render a rss feed" do
@@ -102,9 +102,9 @@ describe Alchemy::PagesController do
102
102
  describe "url nesting" do
103
103
 
104
104
  before(:each) do
105
- @catalog = Factory(:public_page, :name => "Catalog", :parent_id => @default_language_root.id, :language => @default_language)
106
- @products = Factory(:public_page, :name => "Products", :parent_id => @catalog.id, :language => @default_language)
107
- @product = Factory(:public_page, :name => "Screwdriver", :parent_id => @products.id, :language => @default_language)
105
+ @catalog = FactoryGirl.create(:public_page, :name => "Catalog", :parent_id => @default_language_root.id, :language => @default_language)
106
+ @products = FactoryGirl.create(:public_page, :name => "Products", :parent_id => @catalog.id, :language => @default_language)
107
+ @product = FactoryGirl.create(:public_page, :name => "Screwdriver", :parent_id => @products.id, :language => @default_language)
108
108
  @product.elements.find_by_name('article').contents.essence_texts.first.essence.update_attribute(:body, 'screwdriver')
109
109
  controller.stub!(:configuration) { |arg| arg == :url_nesting ? true : false }
110
110
  end
@@ -133,7 +133,7 @@ describe Alchemy::PagesController do
133
133
 
134
134
  context "when a non-existent page is requested" do
135
135
  it "should rescue a RoutingError with rendering a 404 page." do
136
- Factory(:admin_user) # otherwise we are redirected to create_user
136
+ FactoryGirl.create(:admin_user) # otherwise we are redirected to create_user
137
137
  get :show, {:urlname => 'doesntexist'}
138
138
  response.status.should == 404
139
139
  response.body.should have_content('The page you were looking for doesn\'t exist')
@@ -1,25 +1,31 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
1
+ sqlite: &sqlite
7
2
  adapter: sqlite3
8
- database: db/development.sqlite3
3
+ database: db/<%= Rails.env %>.sqlite3
4
+
5
+ mysql: &mysql
6
+ adapter: mysql2
7
+ username: root
8
+ password:
9
+ database: alchemy_cms_dummy_<%= Rails.env %>
10
+
11
+ postgresql: &postgresql
12
+ adapter: postgresql
13
+ username: postgres
14
+ password:
15
+ database: alchemy_cms_dummy_<%= Rails.env %>
16
+ min_messages: ERROR
17
+
18
+ defaults: &defaults
9
19
  pool: 5
10
20
  timeout: 5000
21
+ host: localhost
22
+ <<: *<%= ENV['DB'] || "sqlite" %>
23
+
24
+ development:
25
+ <<: *defaults
11
26
 
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
27
  test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
28
+ <<: *defaults
20
29
 
21
30
  production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
31
+ <<: *defaults
@@ -200,7 +200,7 @@ ActiveRecord::Schema.define(:version => 20120302040145) do
200
200
  t.string "urlname"
201
201
  t.string "title"
202
202
  t.string "language_code"
203
- t.boolean "language_root", :limit => 255
203
+ t.boolean "language_root"
204
204
  t.string "page_layout"
205
205
  t.text "meta_keywords"
206
206
  t.text "meta_description"
@@ -39,9 +39,9 @@ FactoryGirl.define do
39
39
 
40
40
  factory :page, :class => 'Alchemy::Page' do
41
41
 
42
- language { Alchemy::Language.find_by_language_code('kl') || Factory(:language) }
43
- name "A Page"
44
- parent_id { (Alchemy::Page.find_by_language_root(true) || Factory(:language_root_page)).id }
42
+ language { Alchemy::Language.find_by_language_code('kl') || FactoryGirl.create(:language) }
43
+ sequence(:name) { |n| "A Page #{n}" }
44
+ parent_id { (Alchemy::Page.find_by_language_root(true) || FactoryGirl.create(:language_root_page)).id }
45
45
  page_layout "standard"
46
46
 
47
47
  factory :language_root_page do
@@ -53,7 +53,7 @@ FactoryGirl.define do
53
53
  end
54
54
 
55
55
  factory :public_page do
56
- name "A Public Page"
56
+ sequence(:name) { |n| "A Public Page #{n}" }
57
57
  public true
58
58
  end
59
59
 
@@ -68,7 +68,7 @@ FactoryGirl.define do
68
68
  end
69
69
 
70
70
  factory :cell, :class => 'Alchemy::Cell' do
71
- page { Alchemy::Page.find_by_language_root(true) || Factory(:language_root_page) }
71
+ page { Alchemy::Page.find_by_language_root(true) || FactoryGirl.create(:language_root_page) }
72
72
  name "A Cell"
73
73
  end
74
74
 
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Alchemy::Admin::ContentsHelper do
4
4
 
5
5
  before(:each) do
6
- @element = Factory(:element)
6
+ @element = FactoryGirl.create(:element)
7
7
  end
8
8
 
9
9
  it "should render a dom id" do
@@ -5,8 +5,8 @@ include Alchemy::BaseHelper
5
5
  describe Alchemy::Admin::ElementsHelper do
6
6
 
7
7
  before(:each) do
8
- @page = Factory(:public_page)
9
- @element = Factory(:element, :page => @page)
8
+ @page = FactoryGirl.create(:public_page)
9
+ @element = FactoryGirl.create(:element, :page => @page)
10
10
  end
11
11
 
12
12
  it "should render an element editor partial" do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Alchemy::Admin::EssencesHelper do
4
4
 
5
5
  before(:each) do
6
- @element = Factory(:element)
6
+ @element = FactoryGirl.create(:element)
7
7
  @element.content_by_name('intro').essence.update_attributes(:body => 'hello!')
8
8
  end
9
9
 
@@ -5,8 +5,8 @@ include Alchemy::BaseHelper
5
5
  describe Alchemy::ElementsHelper do
6
6
 
7
7
  before(:each) do
8
- @page = Factory(:public_page)
9
- @element = Factory(:element, :page => @page)
8
+ @page = FactoryGirl.create(:public_page)
9
+ @element = FactoryGirl.create(:element, :page => @page)
10
10
  session[:language_id] = @page.language_id
11
11
  end
12
12
 
@@ -26,53 +26,53 @@ describe Alchemy::ElementsHelper do
26
26
 
27
27
  context "with no certain option given" do
28
28
  it "should render all elements from @page" do
29
- @another_element = Factory(:element, :page => @page)
29
+ @another_element = FactoryGirl.create(:element, :page => @page)
30
30
  # m for regex means line breaks are like every character
31
31
  helper.render_elements.should match(/id="#{@element.name}_#{@element.id.to_s}.*id="#{@another_element.name}_#{@another_element.id.to_s}"/m)
32
32
  end
33
33
 
34
34
  it "should not render elements that are in a cell" do
35
- cell = Factory(:cell)
36
- @another_element = Factory(:element, :page => @page, :cell_id => cell.id)
35
+ cell = FactoryGirl.create(:cell)
36
+ @another_element = FactoryGirl.create(:element, :page => @page, :cell_id => cell.id)
37
37
  helper.render_elements.should_not match(/id="#{@another_element.name}_#{@another_element.id}"/)
38
38
  end
39
39
  end
40
40
 
41
41
  context "with except option" do
42
42
  it "should render all elements except a certain one" do
43
- @another_element = Factory(:element, :page => @page)
43
+ @another_element = FactoryGirl.create(:element, :page => @page)
44
44
  helper.render_elements(:except => @another_element.name).should_not match(/id="#{@another_element.name}_\d*"/)
45
45
  end
46
46
  end
47
47
 
48
48
  context "with only option" do
49
49
  it "should render one certain element" do
50
- @another_element = Factory(:element, :name => 'headline', :page => @page)
50
+ @another_element = FactoryGirl.create(:element, :name => 'headline', :page => @page)
51
51
  helper.render_elements(:only => @element.name).should_not match(/id="#{@another_element.name}_\d*"/)
52
52
  end
53
53
  end
54
54
 
55
55
  context "with from_page option" do
56
56
  it "should render all elements from a certain page" do
57
- @another_page = Factory(:public_page, :name => 'Another Page')
58
- @element_on_other_page = Factory(:element, :name => 'headline', :page => @another_page)
57
+ @another_page = FactoryGirl.create(:public_page)
58
+ @element_on_other_page = FactoryGirl.create(:element, :name => 'headline', :page => @another_page)
59
59
  helper.render_elements(:from_page => @another_page).should match(/id="#{@element_on_other_page.name}_\d*"/)
60
60
  end
61
61
 
62
62
  it "should not render any elements in a cell from the given page" do
63
- @another_page = Factory(:public_page, :name => 'And Another Page')
64
- @cell = Factory(:cell, :name => "Celltest", :page => @another_page)
65
- @element_not_in_cell = Factory(:element, :name => 'headline', :page => @another_page)
66
- @element_in_cell = Factory(:element, :name => 'article', :cell => @cell, :page => @another_page)
63
+ @another_page = FactoryGirl.create(:public_page)
64
+ @cell = FactoryGirl.create(:cell, :name => "Celltest", :page => @another_page)
65
+ @element_not_in_cell = FactoryGirl.create(:element, :name => 'headline', :page => @another_page)
66
+ @element_in_cell = FactoryGirl.create(:element, :name => 'article', :cell => @cell, :page => @another_page)
67
67
  helper.render_elements(:from_page => @another_page).should_not match(/id="#{@element_in_cell.name}_#{@element_in_cell.id}*"/)
68
68
  end
69
69
 
70
70
  context "and from_cell option" do
71
71
  it "should render all elements from the page's cell" do
72
- @another_page = Factory(:public_page, :name => 'And even another page')
73
- @cell = Factory(:cell, :name => "Celltest", :page => @another_page)
74
- @element_not_in_cell = Factory(:element, :name => 'headline', :page => @another_page)
75
- @element_in_cell = Factory(:element, :name => 'article', :cell => @cell, :page => @another_page)
72
+ @another_page = FactoryGirl.create(:public_page)
73
+ @cell = FactoryGirl.create(:cell, :name => "Celltest", :page => @another_page)
74
+ @element_not_in_cell = FactoryGirl.create(:element, :name => 'headline', :page => @another_page)
75
+ @element_in_cell = FactoryGirl.create(:element, :name => 'article', :cell => @cell, :page => @another_page)
76
76
  helper.render_elements(:from_page => @another_page, :from_cell => "Celltest").should match(/id="#{@element_in_cell.name}_#{@element_in_cell.id}*"/)
77
77
  end
78
78
  end
@@ -81,25 +81,25 @@ describe Alchemy::ElementsHelper do
81
81
 
82
82
  context "with from_cell option" do
83
83
  it "should render all elements from a certain cell" do
84
- cell = Factory(:cell)
85
- @another_element = Factory(:element, :page => @page, :cell_id => cell.id)
84
+ cell = FactoryGirl.create(:cell)
85
+ @another_element = FactoryGirl.create(:element, :page => @page, :cell_id => cell.id)
86
86
  helper.render_elements(:from_cell => cell).should match(/id="#{@another_element.name}_#{@another_element.id}"/)
87
87
  end
88
88
 
89
89
  context "with from_cell and only option" do
90
90
  it "should render certain elements from a certain cell" do
91
- cell = Factory(:cell)
92
- @another_element = Factory(:element, :page => @page, :cell_id => cell.id)
93
- @another_element2 = Factory(:element, :page => @page)
91
+ cell = FactoryGirl.create(:cell)
92
+ @another_element = FactoryGirl.create(:element, :page => @page, :cell_id => cell.id)
93
+ @another_element2 = FactoryGirl.create(:element, :page => @page)
94
94
  helper.render_elements(:from_cell => cell, :only => @another_element.name).should_not match(/id="#{@another_element2.name}_#{@another_element2.id}"/)
95
95
  end
96
96
  end
97
97
 
98
98
  context "with from_cell and except option" do
99
99
  it "should render all elements except certain ones from a certain cell" do
100
- cell = Factory(:cell)
101
- @another_element = Factory(:element, :page => @page, :cell_id => cell.id)
102
- @another_element2 = Factory(:element, :page => @page, :cell_id => cell.id)
100
+ cell = FactoryGirl.create(:cell)
101
+ @another_element = FactoryGirl.create(:element, :page => @page, :cell_id => cell.id)
102
+ @another_element2 = FactoryGirl.create(:element, :page => @page, :cell_id => cell.id)
103
103
  helper.render_elements(:from_cell => cell, :except => @another_element.name).should_not match(/id="#{@another_element.name}_#{@another_element.id}"/)
104
104
  end
105
105
  end
@@ -109,9 +109,9 @@ describe Alchemy::ElementsHelper do
109
109
  context "with count option" do
110
110
  it "should render just one element because of the count option" do
111
111
  @page.elements.delete_all
112
- @another_element_1 = Factory(:element, :page => @page)
113
- @another_element_2 = Factory(:element, :page => @page)
114
- @another_element_3 = Factory(:element, :page => @page)
112
+ @another_element_1 = FactoryGirl.create(:element, :page => @page)
113
+ @another_element_2 = FactoryGirl.create(:element, :page => @page)
114
+ @another_element_3 = FactoryGirl.create(:element, :page => @page)
115
115
  helper.render_elements(:count => 1).should match(/id="#{@another_element_1.name}_#{@another_element_1.id}"/)
116
116
  end
117
117
  end
@@ -119,10 +119,10 @@ describe Alchemy::ElementsHelper do
119
119
  context "with offset option" do
120
120
  it "should render all elements beginning with the second." do
121
121
  @page.elements.delete_all
122
- @another_page = Factory(:public_page, :name => 'And even one more page')
123
- @another_element_1 = Factory(:element, :page => @page)
124
- @another_element_2 = Factory(:element, :page => @page)
125
- @another_element_3 = Factory(:element, :page => @page)
122
+ @another_page = FactoryGirl.create(:public_page)
123
+ @another_element_1 = FactoryGirl.create(:element, :page => @page)
124
+ @another_element_2 = FactoryGirl.create(:element, :page => @page)
125
+ @another_element_3 = FactoryGirl.create(:element, :page => @page)
126
126
  helper.render_elements(:offset => 1).should_not match(/id="#{@another_element_1.name}_#{@another_element_1.id}"/)
127
127
  end
128
128
  end
@@ -130,7 +130,7 @@ describe Alchemy::ElementsHelper do
130
130
  context "with option fallback" do
131
131
  it "should render the fallback element, when no element with the given name is found" do
132
132
  @page.elements.delete_all
133
- @another_element_1 = Factory(:element, :page => @page)
133
+ @another_element_1 = FactoryGirl.create(:element, :page => @page)
134
134
  helper.render_elements(:fallback => {:for => 'foo', :with => @another_element_1.name, :from => @page.page_layout}).should match(/id="#{@another_element_1.name}_#{@another_element_1.id}"/)
135
135
  end
136
136
  end
@@ -139,8 +139,8 @@ describe Alchemy::ElementsHelper do
139
139
 
140
140
  describe "#render_cell_elements" do
141
141
  it "should render elements for a cell" do
142
- cell = Factory(:cell)
143
- @element_in_cell = Factory(:element, :cell_id => cell.id)
142
+ cell = FactoryGirl.create(:cell)
143
+ @element_in_cell = FactoryGirl.create(:element, :cell_id => cell.id)
144
144
  helper.stub(:configuration).and_return(true)
145
145
  helper.render_cell_elements(cell).should match(/id="#{@element_in_cell.name}_#{@element_in_cell.id}"/)
146
146
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Alchemy::EssencesHelper do
4
4
 
5
5
  before(:each) do
6
- @element = Factory(:element)
6
+ @element = FactoryGirl.create(:element)
7
7
  @element.content_by_name('intro').essence.update_attributes(:body => 'hello!')
8
8
  end
9
9
 
@@ -9,7 +9,7 @@ describe Alchemy::PagesHelper do
9
9
  end
10
10
 
11
11
  it "should render the current page layout" do
12
- @page = Factory(:public_page)
12
+ @page = FactoryGirl.create(:public_page)
13
13
  render_page_layout.should have_selector('div#content')
14
14
  end
15
15
 
@@ -17,8 +17,8 @@ describe Alchemy::PagesHelper do
17
17
 
18
18
  before(:each) do
19
19
  @language = Alchemy::Language.get_default
20
- @root_page = Factory(:language_root_page, :language => @language, :name => 'Home')
21
- @page = Factory(:public_page, :language => @language, :parent_id => @root_page.id, :visible => true)
20
+ @root_page = FactoryGirl.create(:language_root_page, :language => @language, :name => 'Home')
21
+ @page = FactoryGirl.create(:public_page, :language => @language, :parent_id => @root_page.id, :visible => true)
22
22
  end
23
23
 
24
24
  context "not in multi_language mode" do
@@ -28,19 +28,19 @@ describe Alchemy::PagesHelper do
28
28
  end
29
29
 
30
30
  it "should render the page navigation" do
31
- helper.render_navigation.should have_selector('ul.navigation_level_1 li.a-public-page.active.last a.active[href="/alchemy/a-public-page"]')
31
+ helper.render_navigation.should have_selector("ul.navigation_level_1 li.#{@page.urlname}.active.last a.active[href=\"/alchemy/#{@page.urlname}\"]")
32
32
  end
33
33
 
34
34
  context "with enabled url nesting" do
35
35
 
36
36
  before(:each) do
37
37
  helper.stub!(:configuration).and_return(true)
38
- @level2 = Factory(:public_page, :parent_id => @page.id, :language => @language, :name => 'Level 2', :visible => true)
39
- @page = Factory(:public_page, :parent_id => @level2.id, :language => @language, :name => 'Nested Page', :visible => true)
38
+ @level2 = FactoryGirl.create(:public_page, :parent_id => @page.id, :language => @language, :visible => true)
39
+ @level3 = FactoryGirl.create(:public_page, :parent_id => @level2.id, :language => @language, :visible => true)
40
40
  end
41
41
 
42
42
  it "should render nested page links" do
43
- helper.render_navigation(:all_sub_menues => true).should have_selector('ul li a[href="/alchemy/a-public-page/level-2/nested-page"]')
43
+ helper.render_navigation(:all_sub_menues => true).should have_selector("ul li a[href=\"/alchemy/#{@page.urlname}/#{@level2.urlname}/#{@level3.urlname}\"]")
44
44
  end
45
45
 
46
46
  end
@@ -53,11 +53,11 @@ describe Alchemy::PagesHelper do
53
53
 
54
54
  before(:each) do
55
55
  @language = Alchemy::Language.get_default
56
- @language_root = Factory(:language_root_page, :language => @language, :name => 'Intro')
57
- @level_1 = Factory(:public_page, :language => @language, :parent_id => @language_root.id, :visible => true, :name => 'Level 1')
58
- @level_2 = Factory(:public_page, :language => @language, :parent_id => @level_1.id, :visible => true, :name => 'Level 2')
59
- @level_3 = Factory(:public_page, :language => @language, :parent_id => @level_2.id, :visible => true, :name => 'Level 3')
60
- @level_4 = Factory(:public_page, :language => @language, :parent_id => @level_3.id, :visible => true, :name => 'Level 4')
56
+ @language_root = FactoryGirl.create(:language_root_page, :language => @language, :name => 'Intro')
57
+ @level_1 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @language_root.id, :visible => true, :name => 'Level 1')
58
+ @level_2 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_1.id, :visible => true, :name => 'Level 2')
59
+ @level_3 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_2.id, :visible => true, :name => 'Level 3')
60
+ @level_4 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_3.id, :visible => true, :name => 'Level 4')
61
61
  helper.stub(:multi_language?).and_return(false)
62
62
  end
63
63
 
@@ -327,7 +327,7 @@ describe Alchemy::PagesHelper do
327
327
 
328
328
  before :each do
329
329
  @default_language = Alchemy::Language.get_default
330
- @klingonian = Factory(:language)
330
+ @klingonian = FactoryGirl.create(:language)
331
331
  # simulates link_to_public_child = true
332
332
  helper.stub(:multi_language?).and_return(true)
333
333
  helper.stub(:configuration) { |arg| arg == :redirect_to_public_child ? true : false }
@@ -340,8 +340,8 @@ describe Alchemy::PagesHelper do
340
340
  context "with two public languages and two language_roots" do
341
341
 
342
342
  before :each do
343
- @default_language_root = Factory(:language_root_page, :language => @default_language, :name => 'Default Language Root')
344
- @klingonian_language_root = Factory(:language_root_page)
343
+ @default_language_root = FactoryGirl.create(:language_root_page, :language => @default_language, :name => 'Default Language Root')
344
+ @klingonian_language_root = FactoryGirl.create(:language_root_page)
345
345
  end
346
346
 
347
347
  context "and config redirect_to_public_child is set to TRUE" do
@@ -353,8 +353,8 @@ describe Alchemy::PagesHelper do
353
353
 
354
354
  it "should return nil if only one language_root is public and both have none public children" do
355
355
  @klingonian_language_root.update_attributes(:public => false)
356
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
357
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => false, :name => "child1")
356
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
357
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => false, :name => "child1")
358
358
  helper.language_switcher.should == nil
359
359
  end
360
360
 
@@ -364,24 +364,24 @@ describe Alchemy::PagesHelper do
364
364
 
365
365
  it "should render two links when having just one public language_root but a public children in both language_roots" do
366
366
  @klingonian_language_root.update_attributes(:public => false)
367
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
368
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
367
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
368
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
369
369
  helper.language_switcher.should have_selector('a', :count => 2)
370
370
  end
371
371
 
372
372
  it "should render two links when having two not public language_roots but a public children in both" do
373
373
  @default_language_root.update_attributes(:public => false)
374
374
  @klingonian_language_root.update_attributes(:public => false)
375
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
376
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
375
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
376
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
377
377
  helper.language_switcher.should have_selector('a', :count => 2)
378
378
  end
379
379
 
380
380
  it "should return nil when having two not public language_roots and a public children in only one of them" do
381
381
  @default_language_root.update_attributes(:public => false)
382
382
  @klingonian_language_root.update_attributes(:public => false)
383
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
384
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
383
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
384
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
385
385
  helper.language_switcher.should == nil
386
386
  end
387
387
 
@@ -400,16 +400,16 @@ describe Alchemy::PagesHelper do
400
400
 
401
401
  it "should render nil when having just one public language_root but a public children in both language_roots" do
402
402
  @klingonian_language_root.update_attributes(:public => false)
403
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
404
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
403
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
404
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
405
405
  helper.language_switcher.should == nil
406
406
  end
407
407
 
408
408
  it "should render nil when having two not public language_roots but a public children in both" do
409
409
  @default_language_root.update_attributes(:public => false)
410
410
  @klingonian_language_root.update_attributes(:public => false)
411
- @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
412
- @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
411
+ @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
412
+ @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
413
413
  helper.language_switcher.should == nil
414
414
  end
415
415