alchemy_cms 2.0.7 → 2.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. data/.gitignore +1 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +7 -2
  4. data/README.md +6 -6
  5. data/Rakefile +26 -18
  6. data/alchemy_cms.gemspec +14 -14
  7. data/{assets/stylesheets → app/assets/images/alchemy}/Jcrop.gif +0 -0
  8. data/{assets/images → app/assets/images/alchemy}/ajax_loader.gif +0 -0
  9. data/{assets/images → app/assets/images/alchemy}/alchemy-logo.png +0 -0
  10. data/{assets/images → app/assets/images/alchemy}/flags.png +0 -0
  11. data/{assets/images → app/assets/images/alchemy}/gui/navi-tab.png +0 -0
  12. data/{assets/images → app/assets/images/alchemy}/gui/shading_90.png +0 -0
  13. data/{assets/images → app/assets/images/alchemy}/gui/toggle.png +0 -0
  14. data/{assets/images → app/assets/images/alchemy}/icons.png +0 -0
  15. data/{assets/images → app/assets/images/alchemy}/image_loader.gif +0 -0
  16. data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow.gif +0 -0
  17. data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg.gif +0 -0
  18. data/{assets/images → app/assets/images/alchemy}/jquery-sb/select_arrow_bg_hover.gif +0 -0
  19. data/{assets/images → app/assets/images/alchemy}/placeholder.png +0 -0
  20. data/{assets/images/gui → app/assets/images/alchemy}/shading.png +0 -0
  21. data/{assets/images → app/assets/images/alchemy}/swfupload/browse_button.png +0 -0
  22. data/{assets/stylesheets/default/img → app/assets/images/alchemy}/tabs.gif +0 -0
  23. data/{assets/images/jquery-ui → app/assets/images/alchemy}/ui-icons_666666_256x240.png +0 -0
  24. data/app/assets/javascripts/alchemy/alchemy.base.js +212 -0
  25. data/app/assets/javascripts/alchemy/alchemy.buttons.js +36 -0
  26. data/app/assets/javascripts/alchemy/alchemy.dirty.js +91 -0
  27. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +114 -0
  28. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.element_editor_selector.js +0 -0
  29. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.growler.js +0 -0
  30. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.image_cropper.js +0 -0
  31. data/app/assets/javascripts/alchemy/alchemy.js +26 -0
  32. data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +17 -0
  33. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.link_overlay.js +1 -1
  34. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.page_sorter.js +0 -0
  35. data/{assets/javascripts → app/assets/javascripts/alchemy}/alchemy.preview.js +0 -0
  36. data/app/assets/javascripts/alchemy/alchemy.windows.js +438 -0
  37. data/app/assets/stylesheets/alchemy/_defaults.scss +160 -0
  38. data/app/assets/stylesheets/alchemy/alchemy.css +9 -0
  39. data/{assets/stylesheets/alchemy.css → app/assets/stylesheets/alchemy/base.css.scss} +216 -353
  40. data/{assets/stylesheets/elements.css → app/assets/stylesheets/alchemy/elements.css.scss} +41 -70
  41. data/{assets/stylesheets/flags.css → app/assets/stylesheets/alchemy/flags.css.scss} +1 -1
  42. data/{assets/stylesheets/jquery-ui-1.8.7.alchemy.css → app/assets/stylesheets/alchemy/jquery-ui.alchemy.css} +15 -15
  43. data/{assets/stylesheets/jquery.Jcrop.css → app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss} +3 -3
  44. data/{assets/stylesheets/jquery.sb.css → app/assets/stylesheets/alchemy/jquery.sb.css.scss} +19 -29
  45. data/{assets/stylesheets → app/assets/stylesheets/alchemy}/print.css +6 -1
  46. data/{assets/stylesheets → app/assets/stylesheets/alchemy}/standard_set.css +0 -0
  47. data/{assets/stylesheets/alchemy_tinymce_content.css → app/assets/stylesheets/alchemy/tinymce_content.css} +0 -0
  48. data/{assets/stylesheets/alchemy_tinymce_dialog.css → app/assets/stylesheets/alchemy/tinymce_dialog.css} +2 -2
  49. data/app/controllers/admin/attachments_controller.rb +2 -8
  50. data/app/controllers/admin/clipboard_controller.rb +2 -2
  51. data/app/controllers/admin/contents_controller.rb +4 -16
  52. data/app/controllers/admin/elements_controller.rb +2 -2
  53. data/app/controllers/admin/essence_audios_controller.rb +0 -3
  54. data/app/controllers/admin/essence_files_controller.rb +0 -11
  55. data/app/controllers/admin/essence_flashes_controller.rb +0 -3
  56. data/app/controllers/admin/essence_pictures_controller.rb +2 -7
  57. data/app/controllers/admin/essence_videos_controller.rb +0 -3
  58. data/app/controllers/admin/languages_controller.rb +4 -10
  59. data/app/controllers/admin/pages_controller.rb +6 -4
  60. data/app/controllers/admin/pictures_controller.rb +13 -18
  61. data/app/controllers/admin/trash_controller.rb +0 -5
  62. data/app/controllers/admin/users_controller.rb +2 -3
  63. data/app/controllers/alchemy_controller.rb +18 -30
  64. data/app/controllers/pages_controller.rb +21 -24
  65. data/app/helpers/admin/elements_helper.rb +5 -0
  66. data/app/helpers/admin/pages_helper.rb +36 -1
  67. data/app/helpers/alchemy_helper.rb +39 -17
  68. data/app/models/attachment.rb +2 -2
  69. data/app/models/essence_file.rb +1 -1
  70. data/app/models/page.rb +1 -1
  71. data/app/sweepers/pages_sweeper.rb +10 -0
  72. data/app/views/admin/attachments/destroy.js.erb +4 -0
  73. data/app/views/admin/clipboard/insert.js.erb +12 -19
  74. data/app/views/admin/contents/create.js.erb +1 -1
  75. data/app/views/admin/contents/destroy.js.erb +7 -0
  76. data/app/views/admin/contents/order.js.erb +6 -0
  77. data/app/views/admin/elements/_element.html.erb +4 -2
  78. data/app/views/admin/elements/create.js.erb +19 -26
  79. data/app/views/admin/elements/fold.js.erb +1 -1
  80. data/app/views/admin/elements/index.html.erb +1 -1
  81. data/app/views/admin/essence_files/assign.js.erb +8 -0
  82. data/app/views/admin/essence_pictures/save_link.js.erb +3 -0
  83. data/app/views/admin/index.html.erb +37 -27
  84. data/app/views/admin/languages/destroy.js.erb +1 -0
  85. data/app/views/admin/pages/_page.html.erb +1 -1
  86. data/app/views/admin/pages/_sitemap.html.erb +1 -1
  87. data/app/views/admin/pages/edit.html.erb +2 -2
  88. data/app/views/admin/pages/update.js.erb +1 -1
  89. data/app/views/admin/partials/_upload_form.html.erb +11 -11
  90. data/app/views/admin/pictures/archive_overlay.js.erb +1 -0
  91. data/app/views/admin/pictures/flush.js.erb +2 -0
  92. data/app/views/admin/pictures/update.js.erb +1 -0
  93. data/app/views/admin/trash/clear.js.erb +3 -0
  94. data/app/views/alchemy/error_notice.js.erb +1 -0
  95. data/app/views/alchemy/permission_denied.js.erb +2 -0
  96. data/app/views/alchemy/redirect.js.erb +1 -0
  97. data/app/views/alchemy/remote_errors.js.erb +3 -0
  98. data/app/views/alchemy/update.js.erb +5 -0
  99. data/app/views/essences/_essence_file_editor.html.erb +0 -1
  100. data/app/views/essences/_essence_file_view.html.erb +1 -5
  101. data/app/views/essences/_essence_picture_tools.html.erb +1 -1
  102. data/app/views/layouts/alchemy.html.erb +22 -9
  103. data/app/views/pages/show.rss.builder +1 -1
  104. data/config/alchemy/elements.yml +0 -5
  105. data/config/alchemy/page_layouts.yml +1 -1
  106. data/config/asset_packages.yml +17 -19
  107. data/config/authorization_rules.rb +1 -0
  108. data/config/locales/de.yml +0 -1
  109. data/config/routes.rb +1 -1
  110. data/lib/alchemy/tinymce.rb +51 -0
  111. data/lib/alchemy/version.rb +3 -3
  112. data/lib/alchemy_cms.rb +4 -2
  113. data/script/rails +6 -0
  114. data/spec/controllers/admin/clipboard_controller_spec.rb +15 -13
  115. data/spec/controllers/admin/contents_controller_spec.rb +4 -4
  116. data/spec/controllers/admin/trash_controller_spec.rb +6 -9
  117. data/spec/controllers/pages_controller_spec.rb +9 -8
  118. data/spec/dummy/Rakefile +1 -1
  119. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  120. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  121. data/spec/dummy/app/mailers/.gitkeep +0 -0
  122. data/spec/dummy/app/models/.gitkeep +0 -0
  123. data/spec/dummy/app/views/layouts/application.html.erb +3 -3
  124. data/spec/dummy/config/application.rb +12 -6
  125. data/spec/dummy/config/database.yml +3 -0
  126. data/spec/dummy/config/environments/development.rb +7 -3
  127. data/spec/dummy/config/environments/production.rb +23 -12
  128. data/spec/dummy/config/environments/test.rb +5 -1
  129. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  130. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  131. data/spec/dummy/config/locales/en.yml +1 -1
  132. data/spec/dummy/config/routes.rb +1 -1
  133. data/spec/dummy/lib/assets/.gitkeep +0 -0
  134. data/spec/factories.rb +8 -8
  135. data/spec/helpers/admin/elements_helper_spec.rb +2 -2
  136. data/spec/helpers/contents_helper_spec.rb +1 -1
  137. data/spec/helpers/elements_helper_spec.rb +6 -6
  138. data/spec/helpers/essences_helper_spec.rb +1 -1
  139. data/spec/helpers/pages_helper_spec.rb +37 -37
  140. data/spec/integration/pages_controller_spec.rb +29 -26
  141. data/spec/integration/security_spec.rb +2 -1
  142. data/spec/models/content_spec.rb +1 -1
  143. data/spec/models/element_spec.rb +11 -11
  144. data/spec/models/language_spec.rb +5 -5
  145. data/spec/models/page_spec.rb +54 -54
  146. data/spec/models/user_spec.rb +2 -1
  147. data/spec/routing_spec.rb +1 -1
  148. data/{assets/javascripts/jquery.js → vendor/assets/javascripts/jquery-1.6.2.min.js} +0 -0
  149. data/{assets/javascripts/jquery-ui.js → vendor/assets/javascripts/jquery-ui-custom-1.8.16.min.js} +0 -0
  150. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.Jcrop.min.js +0 -0
  151. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.dialogextend.min.js +7 -7
  152. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.in-place-edit.js +0 -0
  153. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.sb.min.js +0 -0
  154. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.scrollTo-1.4.2-min.js +10 -10
  155. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.nestedSortable.js +0 -0
  156. data/{assets/javascripts → vendor/assets/javascripts/jquery_plugins}/jquery.ui.tabspaging.js +0 -0
  157. data/{assets → vendor/assets}/javascripts/swfupload/fileprogress.js +202 -202
  158. data/{assets → vendor/assets}/javascripts/swfupload/handlers.js +171 -171
  159. data/{assets → vendor/assets}/javascripts/swfupload/queue.js +97 -97
  160. data/{assets → vendor/assets}/javascripts/swfupload/swfupload.js +980 -980
  161. data/{assets → vendor/assets}/javascripts/swfupload/swfupload.swf +0 -0
  162. data/{assets → vendor/assets}/javascripts/tiny_mce/jquery.tinymce.js +0 -0
  163. data/{assets → vendor/assets}/javascripts/tiny_mce/langs/de.js +0 -0
  164. data/{assets → vendor/assets}/javascripts/tiny_mce/langs/en.js +0 -0
  165. data/{assets → vendor/assets}/javascripts/tiny_mce/license.txt +504 -504
  166. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/editor_plugin.js +0 -0
  167. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/de.js +0 -0
  168. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/alchemy_link/langs/en.js +0 -0
  169. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +0 -0
  170. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -0
  171. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -110
  172. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -0
  173. data/{assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css → vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.erb} +8 -8
  174. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -387
  175. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/editor_plugin.js +0 -0
  176. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -36
  177. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -51
  178. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/de_dlg.js +0 -0
  179. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +0 -0
  180. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pastetext.htm +26 -26
  181. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -21
  182. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/cell.htm +180 -180
  183. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/cell.css +16 -16
  184. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/row.css +25 -25
  185. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/css/table.css +13 -13
  186. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/editor_plugin.js +0 -0
  187. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/cell.js +319 -319
  188. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -27
  189. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/row.js +237 -237
  190. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/js/table.js +450 -450
  191. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/de_dlg.js +0 -0
  192. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +0 -0
  193. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -32
  194. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/row.htm +158 -158
  195. data/{assets → vendor/assets}/javascripts/tiny_mce/plugins/table/table.htm +188 -188
  196. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/about.htm +52 -52
  197. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -26
  198. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/charmap.htm +51 -51
  199. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -74
  200. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/editor_template.js +0 -0
  201. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/image.htm +80 -80
  202. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  203. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/flash.gif +0 -0
  204. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  205. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/iframe.gif +0 -0
  206. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
  207. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
  208. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
  209. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
  210. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/trans.gif +0 -0
  211. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/video.gif +0 -0
  212. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
  213. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/about.js +73 -73
  214. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/anchor.js +43 -43
  215. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/charmap.js +355 -355
  216. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -329
  217. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/image.js +251 -251
  218. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/link.js +153 -153
  219. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -56
  220. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de.js +0 -0
  221. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/de_dlg.js +0 -0
  222. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en.js +0 -0
  223. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +0 -0
  224. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/link.htm +57 -57
  225. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -47
  226. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/content.css +50 -50
  227. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -117
  228. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  229. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  230. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  231. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  232. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  233. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  234. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -214
  235. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +48 -48
  236. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +117 -117
  237. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  238. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  239. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  240. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +217 -217
  241. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +7 -7
  242. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -5
  243. data/{assets → vendor/assets}/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -25
  244. data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce.js +0 -0
  245. data/{assets → vendor/assets}/javascripts/tiny_mce/tiny_mce_popup.js +0 -0
  246. data/{assets → vendor/assets}/javascripts/tiny_mce/utils/editable_selects.js +70 -70
  247. data/{assets → vendor/assets}/javascripts/tiny_mce/utils/form_utils.js +210 -210
  248. data/{assets → vendor/assets}/javascripts/tiny_mce/utils/mctabs.js +161 -161
  249. data/{assets → vendor/assets}/javascripts/tiny_mce/utils/validate.js +252 -252
  250. metadata +338 -369
  251. data/app/views/elements/_download_editor.html.erb +0 -1
  252. data/app/views/elements/_download_view.html.erb +0 -3
  253. data/assets/javascripts/alchemy.js +0 -903
  254. data/assets/javascripts/jquery.rails.js +0 -315
  255. data/assets/stylesheets/ie6.css +0 -18
  256. data/config/initializers/tinymce_hammer.rb +0 -31
@@ -3,17 +3,17 @@ require 'spec_helper'
3
3
  describe PagesHelper do
4
4
 
5
5
  it "should render the current page layout" do
6
- @page = FactoryGirl.create(:public_page)
6
+ @page = Factory(:public_page)
7
7
  helper.stub(:configuration).and_return(true)
8
8
  render_page_layout.should have_selector('div#content')
9
9
  end
10
10
 
11
11
  context "navigation and meta data" do
12
-
12
+
13
13
  before(:each) do
14
14
  @language = Language.get_default
15
- @root_page = FactoryGirl.create(:language_root_page, :language => @language, :name => 'Home')
16
- @page = FactoryGirl.create(:public_page, :language => @language, :parent_id => @root_page.id, :visible => true)
15
+ @root_page = Factory(:language_root_page, :language => @language, :name => 'Home')
16
+ @page = Factory(:public_page, :language => @language, :parent_id => @root_page.id, :visible => true)
17
17
  helper.stub(:multi_language?).and_return(false)
18
18
  end
19
19
 
@@ -24,7 +24,7 @@ describe PagesHelper do
24
24
  it "should render a breadcrumb to current page" do
25
25
  helper.render_breadcrumb.should have_selector('a.active.last[href="/a-public-page"]')
26
26
  end
27
-
27
+
28
28
  it "should render meta tags for current page" do
29
29
  helper.render_meta_data(:title_prefix => 'Peters Petshop').should have_selector('title[contains("Peters Petshop | A Public Page")]')
30
30
  end
@@ -39,7 +39,7 @@ describe PagesHelper do
39
39
 
40
40
  before :each do
41
41
  @default_language = Language.get_default
42
- @klingonian = FactoryGirl.create(:language)
42
+ @klingonian = Factory(:language)
43
43
  # simulates link_to_public_child = true
44
44
  helper.stub(:configuration).and_return(true)
45
45
  helper.stub(:multi_language?).and_return(true)
@@ -53,88 +53,88 @@ describe PagesHelper do
53
53
  context "with two public languages and two language_roots" do
54
54
 
55
55
  before :each do
56
- @default_language_root = FactoryGirl.create(:language_root_page, :language => @default_language, :name => 'Default Language Root')
57
- @klingonian_language_root = FactoryGirl.create(:language_root_page)
56
+ @default_language_root = Factory(:language_root_page, :language => @default_language, :name => 'Default Language Root')
57
+ @klingonian_language_root = Factory(:language_root_page)
58
58
  end
59
-
59
+
60
60
  context "and config redirect_to_public_child is set to TRUE" do
61
-
61
+
62
62
  before :each do
63
63
  # simulates link_to_public_child = true
64
64
  helper.stub(:configuration).and_return(true)
65
65
  end
66
-
66
+
67
67
  it "should return nil if only one language_root is public and both do not have children" do
68
68
  @klingonian_language_root.update_attributes(:public => false)
69
69
  helper.language_switches.should == nil
70
70
  end
71
-
71
+
72
72
  it "should return nil if only one language_root is public and both have none public children" do
73
73
  @klingonian_language_root.update_attributes(:public => false)
74
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
75
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => false, :name => "child1")
74
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
75
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => false, :name => "child1")
76
76
  helper.language_switches.should == nil
77
77
  end
78
-
78
+
79
79
  it "should render two links when having two public language_root pages" do
80
80
  helper.language_switches.should have_selector('a', :count => 2)
81
81
  end
82
-
82
+
83
83
  it "should render two links when having just one public language_root but a public children in both language_roots" do
84
84
  @klingonian_language_root.update_attributes(:public => false)
85
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
86
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
85
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
86
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
87
87
  helper.language_switches.should have_selector('a', :count => 2)
88
88
  end
89
-
89
+
90
90
  it "should render two links when having two not public language_roots but a public children in both" do
91
91
  @default_language_root.update_attributes(:public => false)
92
92
  @klingonian_language_root.update_attributes(:public => false)
93
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
94
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
93
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
94
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
95
95
  helper.language_switches.should have_selector('a', :count => 2)
96
96
  end
97
-
97
+
98
98
  it "should return nil when having two not public language_roots and a public children in only one of them" do
99
99
  @default_language_root.update_attributes(:public => false)
100
100
  @klingonian_language_root.update_attributes(:public => false)
101
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
102
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
101
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
102
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
103
103
  helper.language_switches.should == nil
104
104
  end
105
-
105
+
106
106
  end
107
-
107
+
108
108
  context "and config redirect_to_public_child is set to FALSE" do
109
-
109
+
110
110
  before :each do
111
111
  # simulates link_to_public_child = false
112
112
  helper.stub(:configuration).and_return(false)
113
113
  end
114
-
114
+
115
115
  it "should render two links when having two public language_root pages" do
116
116
  helper.language_switches.should have_selector('a', :count => 2)
117
117
  end
118
-
118
+
119
119
  it "should render nil when having just one public language_root but a public children in both language_roots" do
120
120
  @klingonian_language_root.update_attributes(:public => false)
121
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
122
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
121
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
122
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
123
123
  helper.language_switches.should == nil
124
124
  end
125
-
125
+
126
126
  it "should render nil when having two not public language_roots but a public children in both" do
127
127
  @default_language_root.update_attributes(:public => false)
128
128
  @klingonian_language_root.update_attributes(:public => false)
129
- @default_first_public_child = FactoryGirl.create(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
130
- @klingonian_first_public_child = FactoryGirl.create(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
129
+ @default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
130
+ @klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
131
131
  helper.language_switches.should == nil
132
132
  end
133
-
133
+
134
134
  end
135
-
135
+
136
136
  end
137
-
137
+
138
138
  end
139
139
 
140
140
  end
@@ -4,15 +4,18 @@ describe PagesController do
4
4
 
5
5
  before(:each) do
6
6
  # We need an user or the signup view will show up
7
- FactoryGirl.create(:admin_user)
7
+
8
+ user = Factory.build(:admin_user)
9
+ user.save_without_session_maintenance
10
+
8
11
  @default_language = Language.get_default
9
- @default_language_root = FactoryGirl.create(:language_root_page, :language => @default_language, :name => 'Home')
12
+ @default_language_root = Factory(:language_root_page, :language => @default_language, :name => 'Home')
10
13
  end
11
14
 
12
15
  context "rendering a page" do
13
16
 
14
17
  it "should including all its elements and contents" do
15
- p = FactoryGirl.create(:public_page, :language => @default_language)
18
+ p = Factory(:public_page, :language => @default_language)
16
19
  article = p.elements.find_by_name('article')
17
20
  article.content_by_name('intro').essence.update_attributes(:body => 'Welcome to Peters Petshop', :public => true)
18
21
  visit '/a-public-page'
@@ -21,8 +24,8 @@ describe PagesController do
21
24
 
22
25
  it "should have show the navigation with all visible pages" do
23
26
  pages = [
24
- FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id),
25
- FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 2', :parent_id => @default_language_root.id)
27
+ Factory(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id),
28
+ Factory(:public_page, :language => @default_language, :visible => true, :name => 'Page 2', :parent_id => @default_language_root.id)
26
29
  ]
27
30
  visit '/'
28
31
  within('div#navigation ul') { page.should have_selector('li a[href="/page-1"], li a[href="/page-2"]') }
@@ -31,34 +34,34 @@ describe PagesController do
31
34
  end
32
35
 
33
36
  context "performing a fulltext search" do
34
-
37
+
35
38
  before(:each) do
36
- @page = FactoryGirl.create(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id)
37
- @element = FactoryGirl.create(:element, :name => 'article', :page => @page)
39
+ @page = Factory(:public_page, :language => @default_language, :visible => true, :name => 'Page 1', :parent_id => @default_language_root.id)
40
+ @element = Factory(:element, :name => 'article', :page => @page)
38
41
  end
39
-
42
+
40
43
  it "should display search results for richtext essences" do
41
44
  @element.content_by_name('text').essence.update_attributes(:body => '<p>Welcome to Peters Petshop</p>', :public => true)
42
- search_result_page = FactoryGirl.create(:public_page, :language => @default_language, :name => 'Suche', :page_layout => 'search', :parent_id => @default_language_root.id)
45
+ search_result_page = Factory(:public_page, :language => @default_language, :name => 'Suche', :page_layout => 'search', :parent_id => @default_language_root.id)
43
46
  visit('/suche?query=Petshop')
44
47
  within('div#content .searchresult') { page.should have_content('Petshop') }
45
48
  end
46
-
49
+
47
50
  it "should display search results for text essences" do
48
51
  @element.content_by_name('intro').essence.update_attributes(:body => 'Welcome to Peters Petshop', :public => true)
49
- search_result_page = FactoryGirl.create(:public_page, :language => @default_language, :name => 'Suche', :page_layout => 'search', :parent_id => @default_language_root.id)
52
+ search_result_page = Factory(:public_page, :language => @default_language, :name => 'Suche', :page_layout => 'search', :parent_id => @default_language_root.id)
50
53
  visit('/suche?query=Petshop')
51
54
  within('div#content .searchresult') { page.should have_content('Petshop') }
52
55
  end
53
-
56
+
54
57
  end
55
58
 
56
59
  context "redirecting" do
57
-
60
+
58
61
  context "in multi language mode" do
59
62
 
60
63
  before(:each) do
61
- @page = FactoryGirl.create(:public_page)
64
+ @page = Factory(:public_page)
62
65
  end
63
66
 
64
67
  it "should redirect to url with nested language code" do
@@ -67,12 +70,12 @@ describe PagesController do
67
70
  end
68
71
 
69
72
  context "should redirect to public child" do
70
-
73
+
71
74
  before(:each) do
72
75
  @page.update_attributes(:public => false, :name => 'Not Public', :urlname => '')
73
- @child = FactoryGirl.create(:public_page, :name => 'Public Child', :parent_id => @page.id)
76
+ @child = Factory(:public_page, :name => 'Public Child', :parent_id => @page.id)
74
77
  end
75
-
78
+
76
79
  it ", if requested page is unpublished" do
77
80
  visit '/kl/not-public'
78
81
  page.current_path.should == '/kl/public-child'
@@ -82,7 +85,7 @@ describe PagesController do
82
85
  visit '/not-public'
83
86
  page.current_path.should == '/kl/public-child'
84
87
  end
85
-
88
+
86
89
  end
87
90
 
88
91
  it "should redirect to pages url, if requested url is index url" do
@@ -101,11 +104,11 @@ describe PagesController do
101
104
  end
102
105
 
103
106
  end
104
-
107
+
105
108
  context "not in multi language mode" do
106
109
 
107
110
  before(:each) do
108
- @page = FactoryGirl.create(:public_page, :language => @default_language, :parent_id => @default_language_root.id)
111
+ @page = Factory(:public_page, :language => @default_language, :parent_id => @default_language_root.id)
109
112
  end
110
113
 
111
114
  it "should redirect from nested language code url to normal url" do
@@ -114,12 +117,12 @@ describe PagesController do
114
117
  end
115
118
 
116
119
  context "should redirect to public child" do
117
-
120
+
118
121
  before(:each) do
119
122
  @page.update_attributes(:public => false, :name => 'Not Public', :urlname => '')
120
- @child = FactoryGirl.create(:public_page, :name => 'Public Child', :parent_id => @page.id, :language => @default_language)
123
+ @child = Factory(:public_page, :name => 'Public Child', :parent_id => @page.id, :language => @default_language)
121
124
  end
122
-
125
+
123
126
  it ", if requested page is unpublished" do
124
127
  visit '/not-public'
125
128
  page.current_path.should == '/public-child'
@@ -129,7 +132,7 @@ describe PagesController do
129
132
  visit '/de/not-public'
130
133
  page.current_path.should == '/public-child'
131
134
  end
132
-
135
+
133
136
  end
134
137
 
135
138
  it "should redirect to pages url, if requested url is index url" do
@@ -143,7 +146,7 @@ describe PagesController do
143
146
  end
144
147
 
145
148
  end
146
-
149
+
147
150
  end
148
151
 
149
152
  end
@@ -16,7 +16,8 @@ describe "Security: " do
16
16
 
17
17
  context "If on or more users are present" do
18
18
  it "a visitor should not be able to signup" do
19
- @user = User.create({:login => 'foo', :email => 'foo@bar.com', :password => 's3cr3t', :password_confirmation => 's3cr3t'})
19
+ @user = User.new({:login => 'foo', :email => 'foo@bar.com', :password => 's3cr3t', :password_confirmation => 's3cr3t'})
20
+ @user.save_without_session_maintenance
20
21
  visit '/admin/signup'
21
22
  within('#alchemy_greeting') { page.should_not have_content('have to signup') }
22
23
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Content do
4
4
 
5
5
  it "should return the ingredient from its essence" do
6
- FactoryGirl.create(:element)
6
+ Factory(:element)
7
7
  EssenceText.first.update_attributes(:body => "Hello")
8
8
  Content.first.ingredient.should == EssenceText.first.ingredient
9
9
  end
@@ -9,19 +9,19 @@ describe Element do
9
9
  end
10
10
 
11
11
  it "should return all public elements" do
12
- elements = [FactoryGirl.create(:element, :public => true), FactoryGirl.create(:element, :public => true)]
12
+ elements = [Factory(:element, :public => true), Factory(:element, :public => true)]
13
13
  Element.published.all.should == elements
14
14
  end
15
15
 
16
16
  it "should return all elements by name" do
17
- elements = [FactoryGirl.create(:element, :name => 'article'), FactoryGirl.create(:element, :name => 'article')]
17
+ elements = [Factory(:element, :name => 'article'), Factory(:element, :name => 'article')]
18
18
  Element.named(['article']).all.should == elements
19
19
  end
20
20
 
21
21
  it "should return all elements but excluded ones" do
22
- FactoryGirl.create(:element, :name => 'article')
23
- FactoryGirl.create(:element, :name => 'article')
24
- excluded = [FactoryGirl.create(:element, :name => 'claim')]
22
+ Factory(:element, :name => 'article')
23
+ Factory(:element, :name => 'article')
24
+ excluded = [Factory(:element, :name => 'claim')]
25
25
  Element.excluded(['article']).all.should == excluded
26
26
  end
27
27
 
@@ -47,7 +47,7 @@ describe Element do
47
47
  context "retrieving contents, essences and ingredients" do
48
48
 
49
49
  before(:each) do
50
- @element = FactoryGirl.create(:element, :name => 'news')
50
+ @element = Factory(:element, :name => 'news')
51
51
  end
52
52
 
53
53
  it "should return an ingredient by name" do
@@ -65,7 +65,7 @@ describe Element do
65
65
  end
66
66
 
67
67
  it "should return a collection of trashed elements" do
68
- @element = FactoryGirl.create(:element)
68
+ @element = Factory(:element)
69
69
  @element.trash
70
70
  Element.trashed.should include(@element)
71
71
  end
@@ -73,14 +73,14 @@ describe Element do
73
73
  context "trashed" do
74
74
 
75
75
  before(:each) do
76
- @element = FactoryGirl.create(:element)
76
+ @element = Factory(:element)
77
77
  @element.trash
78
78
  end
79
-
79
+
80
80
  it "should be not public" do
81
81
  @element.public.should be_false
82
82
  end
83
-
83
+
84
84
  it "should have no page" do
85
85
  @element.page.should == nil
86
86
  end
@@ -88,7 +88,7 @@ describe Element do
88
88
  it "should be folded" do
89
89
  @element.folded.should == true
90
90
  end
91
-
91
+
92
92
  end
93
93
 
94
94
  it "should raise error if all_for_page method has no page" do
@@ -3,25 +3,25 @@ require 'spec_helper'
3
3
  describe Language do
4
4
 
5
5
  before(:all) do
6
- @language = FactoryGirl.create(:language)
6
+ @language = Factory(:language)
7
7
  end
8
-
8
+
9
9
  after(:all) do
10
10
  @language.destroy if @language
11
11
  end
12
12
 
13
13
  it "should return a label for code" do
14
14
  @language.label(:code).should == 'kl'
15
- end
15
+ end
16
16
 
17
17
  it "should return a label for name" do
18
18
  @language.label(:name).should == 'Klingonian'
19
19
  end
20
-
20
+
21
21
  it "should not be deletable if it is the default language" do
22
22
  @default_language = Language.find_by_default(true)
23
23
  if !@default_language
24
- @default_language = FactoryGirl.create(:language, :name => "default", :code => "aa", :frontpage_name => "intro", :default => true)
24
+ @default_language = Factory(:language, :name => "default", :code => "aa", :frontpage_name => "intro", :default => true)
25
25
  end
26
26
  expect { @default_language.destroy }.should raise_error
27
27
  end
@@ -3,58 +3,58 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Page do
6
-
6
+
7
7
  before(:each) do
8
8
  @rootpage = Page.rootpage
9
9
  @language = Language.get_default
10
- @language_root = FactoryGirl.create(:page, :parent_id => @rootpage.id, :language => @language, :language_root => true, :page_layout => 'intro')
10
+ @language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language, :language_root => true, :page_layout => 'intro')
11
11
  end
12
-
12
+
13
13
  describe ".layout_description" do
14
-
14
+
15
15
  context "for a language root page" do
16
-
16
+
17
17
  it "should return the page layout description as hash" do
18
18
  @language_root.layout_description['name'].should == 'intro'
19
19
  end
20
-
20
+
21
21
  it "should return an empty hash for root page" do
22
22
  @rootpage.layout_description.should == {}
23
23
  end
24
-
24
+
25
25
  end
26
-
26
+
27
27
  it "should raise Exception if the page_layout could not be found in the definition file" do
28
28
  @page = mock(:page, :page_layout => 'foo')
29
29
  expect { @page.layout_description }.to raise_error
30
30
  end
31
-
31
+
32
32
  end
33
-
33
+
34
34
  it "should contain one rootpage" do
35
35
  Page.rootpage.should be_instance_of(Page)
36
36
  end
37
37
 
38
38
  it "should return all rss feed elements" do
39
- @page = FactoryGirl.create(:public_page, :page_layout => 'news', :parent_id => @language_root.id, :language => @language)
39
+ @page = Factory(:public_page, :page_layout => 'news', :parent_id => @language_root.id, :language => @language)
40
40
  @page.feed_elements.should == Element.find_all_by_name('news')
41
41
  end
42
-
42
+
43
43
  context "finding elements" do
44
-
44
+
45
45
  before(:each) do
46
- @page = FactoryGirl.create(:public_page)
46
+ @page = Factory(:public_page)
47
47
  @non_public_elements = [
48
- FactoryGirl.create(:element, :public => false, :page => @page),
49
- FactoryGirl.create(:element, :public => false, :page => @page)
48
+ Factory(:element, :public => false, :page => @page),
49
+ Factory(:element, :public => false, :page => @page)
50
50
  ]
51
51
  end
52
-
52
+
53
53
  it "should return the collection of elements if passed an array into options[:collection]" do
54
54
  options = {:collection => @page.elements}
55
55
  @page.find_elements(options).all.should == @page.elements.all
56
56
  end
57
-
57
+
58
58
  context "with show_non_public argument TRUE" do
59
59
 
60
60
  it "should return all elements from empty options" do
@@ -78,7 +78,7 @@ describe Page do
78
78
  end
79
79
 
80
80
  end
81
-
81
+
82
82
  context "with show_non_public argument FALSE" do
83
83
 
84
84
  it "should return all elements from empty arguments" do
@@ -102,56 +102,56 @@ describe Page do
102
102
  end
103
103
 
104
104
  end
105
-
105
+
106
106
  end
107
-
107
+
108
108
  context "create" do
109
109
  it "the rootpage with page_layout rootpage does not need a parent_id" do
110
110
  @rootpage.rootpage?.should be_true
111
111
  end
112
-
112
+
113
113
  it "all pages except the rootpage must have a parent_id" do
114
- page = FactoryGirl.build(:page, :page_layout => "anypage", :parent_id => nil, :language => @language)
114
+ page = Factory.build(:page, :page_layout => "anypage", :parent_id => nil, :language => @language)
115
115
  page.valid?
116
116
  page.should have(1).error_on(:parent_id)
117
117
  end
118
-
118
+
119
119
  it "must not be created if the page_layout is set to 'rootpage' and a page already exists with this page_layout and parent_id = nil" do
120
- page = FactoryGirl.build(:page, :name => "anypage", :page_layout => "rootpage", :parent_id => @language_root.id, :language => @language)
120
+ page = Factory.build(:page, :name => "anypage", :page_layout => "rootpage", :parent_id => @language_root.id, :language => @language)
121
121
  page.valid?
122
122
  page.should have(1).error_on(:page_layout)
123
123
  end
124
-
124
+
125
125
  it "should get a webfriendly urlname on create" do
126
- page = FactoryGirl.create(:page, :name => 'klingon$&stößel ', :language => @language, :parent_id => @language_root.id)
126
+ page = Factory(:page, :name => 'klingon$&stößel ', :language => @language, :parent_id => @language_root.id)
127
127
  page.urlname.should == 'klingon-stoessel'
128
128
  end
129
129
 
130
130
  it "should generate a three letter urlname from two letter name" do
131
- page = FactoryGirl.create(:page, :name => 'Au', :language => @language, :parent_id => @language_root.id)
131
+ page = Factory(:page, :name => 'Au', :language => @language, :parent_id => @language_root.id)
132
132
  page.urlname.should == '-au'
133
133
  end
134
134
 
135
135
  it "should generate a three letter urlname from two letter name with umlaut" do
136
- page = FactoryGirl.create(:page, :name => 'Aü', :language => @language, :parent_id => @language_root.id)
136
+ page = Factory(:page, :name => 'Aü', :language => @language, :parent_id => @language_root.id)
137
137
  page.urlname.should == 'aue'
138
138
  end
139
139
 
140
140
  it "should generate a three letter urlname from one letter name" do
141
- page = FactoryGirl.create(:page, :name => 'A', :language => @language, :parent_id => @language_root.id)
141
+ page = Factory(:page, :name => 'A', :language => @language, :parent_id => @language_root.id)
142
142
  page.urlname.should == '--a'
143
143
  end
144
144
  end
145
-
145
+
146
146
  context "with children" do
147
147
  before(:each) do
148
- @first_child = FactoryGirl.create(:page, :name => "First child", :language => @language, :public => false, :parent_id => @language_root.id)
148
+ @first_child = Factory(:page, :name => "First child", :language => @language, :public => false, :parent_id => @language_root.id)
149
149
  @first_child.move_to_child_of(@language_root)
150
-
151
- @first_public_child = FactoryGirl.create(:page, :name => "First public child", :language => @language, :parent_id => @language_root.id, :public => true)
150
+
151
+ @first_public_child = Factory(:page, :name => "First public child", :language => @language, :parent_id => @language_root.id, :public => true)
152
152
  @first_public_child.move_to_child_of(@language_root)
153
153
  end
154
-
154
+
155
155
  it "should return a page object (or nil if no public child exists) for first_public_child" do
156
156
  if @language_root.children.any?
157
157
  @language_root.first_public_child.should == @first_public_child
@@ -160,63 +160,63 @@ describe Page do
160
160
  end
161
161
  end
162
162
  end
163
-
163
+
164
164
  context ".public" do
165
165
  it "should return 2 pages that are public" do
166
- FactoryGirl.create(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
167
- FactoryGirl.create(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
166
+ Factory(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
167
+ Factory(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
168
168
  Page.published.should have(2).pages
169
169
  end
170
170
  end
171
-
171
+
172
172
  context ".not_locked" do
173
173
  it "should return 3 pages that are not blocked by a user at the moment" do
174
- FactoryGirl.create(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
175
- FactoryGirl.create(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
174
+ Factory(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
175
+ Factory(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
176
176
  Page.not_locked.should have(3).pages
177
177
  end
178
178
  end
179
179
  context ".all_locked" do
180
180
  it "should return 1 page that is blocked by a user at the moment" do
181
- FactoryGirl.create(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
181
+ Factory(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
182
182
  Page.all_locked.should have(1).pages
183
183
  end
184
184
  end
185
-
185
+
186
186
  context ".language_roots" do
187
187
  it "should return 1 language_root" do
188
- FactoryGirl.create(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
188
+ Factory(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
189
189
  Page.language_roots.should have(1).pages
190
190
  end
191
191
  end
192
-
193
-
192
+
193
+
194
194
  context ".layoutpages" do
195
195
  it "should return 1 layoutpage" do
196
- FactoryGirl.create(:public_page, :layoutpage => true, :name => 'Layoutpage', :parent_id => @rootpage.id, :language => @language)
196
+ Factory(:public_page, :layoutpage => true, :name => 'Layoutpage', :parent_id => @rootpage.id, :language => @language)
197
197
  Page.layoutpages.should have(1).pages
198
198
  end
199
199
  end
200
-
200
+
201
201
  context ".visible" do
202
202
  it "should return 1 visible page" do
203
- FactoryGirl.create(:public_page, :name => 'First Public Child', :visible => true, :parent_id => @language_root.id, :language => @language)
203
+ Factory(:public_page, :name => 'First Public Child', :visible => true, :parent_id => @language_root.id, :language => @language)
204
204
  Page.visible.should have(1).pages
205
205
  end
206
206
  end
207
-
207
+
208
208
  context ".accessable" do
209
209
  it "should return 2 accessable pages" do
210
- FactoryGirl.create(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
210
+ Factory(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
211
211
  Page.accessable.should have(2).pages
212
212
  end
213
213
  end
214
-
214
+
215
215
  context ".restricted" do
216
216
  it "should return 1 restricted page" do
217
- FactoryGirl.create(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
217
+ Factory(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
218
218
  Page.restricted.should have(1).pages
219
219
  end
220
220
  end
221
-
221
+
222
222
  end