alchemy_cms 3.3.0.rc1 → 3.3.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -2
  3. data/Gemfile +1 -0
  4. data/alchemy_cms.gemspec +6 -6
  5. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -7
  6. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +4 -4
  7. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +51 -5
  8. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +0 -2
  9. data/app/assets/stylesheets/alchemy/elements.scss +2 -2
  10. data/app/controllers/alchemy/admin/elements_controller.rb +2 -0
  11. data/app/controllers/alchemy/admin/pages_controller.rb +11 -3
  12. data/app/controllers/alchemy/admin/pictures_controller.rb +1 -0
  13. data/app/models/alchemy/element.rb +3 -1
  14. data/app/models/alchemy/element/element_contents.rb +2 -7
  15. data/app/models/alchemy/element/presenters.rb +11 -4
  16. data/app/models/alchemy/page.rb +3 -1
  17. data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
  18. data/app/views/alchemy/admin/contents/create.js.erb +0 -1
  19. data/app/views/alchemy/admin/elements/_element_header.html.erb +3 -1
  20. data/app/views/alchemy/admin/elements/order.js.erb +25 -10
  21. data/app/views/alchemy/admin/elements/update.js.erb +1 -2
  22. data/app/views/alchemy/admin/essence_files/assign.js.erb +0 -1
  23. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -1
  24. data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +0 -1
  25. data/app/views/alchemy/admin/pages/destroy.js.erb +0 -1
  26. data/app/views/alchemy/admin/pages/update.js.erb +6 -4
  27. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +2 -1
  28. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -7
  29. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +0 -1
  30. data/bin/alchemy +1 -1
  31. data/bin/rspec +3 -2
  32. data/bin/spring +6 -6
  33. data/config/alchemy/config.yml +6 -1
  34. data/lib/alchemy/seeder.rb +9 -3
  35. data/lib/alchemy/version.rb +1 -1
  36. metadata +6 -471
  37. data/spec/controllers/alchemy/admin/attachments_controller_spec.rb +0 -193
  38. data/spec/controllers/alchemy/admin/base_controller_spec.rb +0 -87
  39. data/spec/controllers/alchemy/admin/clipboard_controller_spec.rb +0 -60
  40. data/spec/controllers/alchemy/admin/contents_controller_spec.rb +0 -78
  41. data/spec/controllers/alchemy/admin/dashboard_controller_spec.rb +0 -144
  42. data/spec/controllers/alchemy/admin/elements_controller_spec.rb +0 -496
  43. data/spec/controllers/alchemy/admin/essence_files_controller_spec.rb +0 -76
  44. data/spec/controllers/alchemy/admin/essence_pictures_controller_spec.rb +0 -202
  45. data/spec/controllers/alchemy/admin/languages_controller_spec.rb +0 -73
  46. data/spec/controllers/alchemy/admin/layoutpages_controller_spec.rb +0 -21
  47. data/spec/controllers/alchemy/admin/pages_controller_spec.rb +0 -639
  48. data/spec/controllers/alchemy/admin/pictures_controller_spec.rb +0 -383
  49. data/spec/controllers/alchemy/admin/resources_controller_spec.rb +0 -81
  50. data/spec/controllers/alchemy/admin/tags_controller_spec.rb +0 -63
  51. data/spec/controllers/alchemy/admin/trash_controller_spec.rb +0 -67
  52. data/spec/controllers/alchemy/api/contents_controller_spec.rb +0 -125
  53. data/spec/controllers/alchemy/api/elements_controller_spec.rb +0 -124
  54. data/spec/controllers/alchemy/api/pages_controller_spec.rb +0 -167
  55. data/spec/controllers/alchemy/attachments_controller_spec.rb +0 -64
  56. data/spec/controllers/alchemy/base_controller_spec.rb +0 -106
  57. data/spec/controllers/alchemy/elements_controller_spec.rb +0 -48
  58. data/spec/controllers/alchemy/messages_controller_spec.rb +0 -204
  59. data/spec/controllers/alchemy/on_page_layout_mixin_spec.rb +0 -330
  60. data/spec/controllers/alchemy/pages_controller_spec.rb +0 -343
  61. data/spec/controllers/alchemy/pictures_controller_spec.rb +0 -415
  62. data/spec/dummy/Rakefile +0 -6
  63. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  64. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  65. data/spec/dummy/app/controllers/admin/events_controller.rb +0 -3
  66. data/spec/dummy/app/controllers/application_controller.rb +0 -15
  67. data/spec/dummy/app/controllers/login_controller.rb +0 -5
  68. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  69. data/spec/dummy/app/mailers/.gitkeep +0 -0
  70. data/spec/dummy/app/models/ability.rb +0 -9
  71. data/spec/dummy/app/models/dummy_model.rb +0 -3
  72. data/spec/dummy/app/models/dummy_user.rb +0 -15
  73. data/spec/dummy/app/models/event.rb +0 -10
  74. data/spec/dummy/app/models/location.rb +0 -3
  75. data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +0 -11
  76. data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_view.html.erb +0 -31
  77. data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +0 -6
  78. data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +0 -10
  79. data/spec/dummy/app/views/alchemy/elements/_bild_editor.html.erb +0 -3
  80. data/spec/dummy/app/views/alchemy/elements/_bild_view.html.erb +0 -5
  81. data/spec/dummy/app/views/alchemy/elements/_contactform_editor.html.erb +0 -6
  82. data/spec/dummy/app/views/alchemy/elements/_contactform_view.html.erb +0 -16
  83. data/spec/dummy/app/views/alchemy/elements/_download_editor.html.erb +0 -3
  84. data/spec/dummy/app/views/alchemy/elements/_download_view.html.erb +0 -5
  85. data/spec/dummy/app/views/alchemy/elements/_erb_element_editor.html.erb +0 -3
  86. data/spec/dummy/app/views/alchemy/elements/_erb_element_view.html.erb +0 -5
  87. data/spec/dummy/app/views/alchemy/elements/_header_editor.html.erb +0 -3
  88. data/spec/dummy/app/views/alchemy/elements/_header_view.html.erb +0 -5
  89. data/spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb +0 -1
  90. data/spec/dummy/app/views/alchemy/elements/_headline_view.html.erb +0 -1
  91. data/spec/dummy/app/views/alchemy/elements/_news_editor.html.erb +0 -5
  92. data/spec/dummy/app/views/alchemy/elements/_news_view.html.erb +0 -11
  93. data/spec/dummy/app/views/alchemy/elements/_search_editor.html.erb +0 -1
  94. data/spec/dummy/app/views/alchemy/elements/_search_view.html.erb +0 -4
  95. data/spec/dummy/app/views/alchemy/elements/_slide_editor.html.erb +0 -3
  96. data/spec/dummy/app/views/alchemy/elements/_slide_view.html.erb +0 -5
  97. data/spec/dummy/app/views/alchemy/elements/_slider_editor.html.erb +0 -2
  98. data/spec/dummy/app/views/alchemy/elements/_slider_view.html.erb +0 -4
  99. data/spec/dummy/app/views/alchemy/elements/_text_editor.html.erb +0 -3
  100. data/spec/dummy/app/views/alchemy/elements/_text_view.html.erb +0 -5
  101. data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +0 -15
  102. data/spec/dummy/app/views/layouts/application.html.erb +0 -17
  103. data/spec/dummy/bin/bundle +0 -3
  104. data/spec/dummy/bin/rails +0 -4
  105. data/spec/dummy/bin/rake +0 -4
  106. data/spec/dummy/config.ru +0 -4
  107. data/spec/dummy/config/alchemy/cells.yml +0 -5
  108. data/spec/dummy/config/alchemy/elements.yml +0 -109
  109. data/spec/dummy/config/alchemy/page_layouts.yml +0 -32
  110. data/spec/dummy/config/application.rb +0 -32
  111. data/spec/dummy/config/boot.rb +0 -5
  112. data/spec/dummy/config/database.yml +0 -32
  113. data/spec/dummy/config/environment.rb +0 -5
  114. data/spec/dummy/config/environments/development.rb +0 -41
  115. data/spec/dummy/config/environments/production.rb +0 -77
  116. data/spec/dummy/config/environments/test.rb +0 -43
  117. data/spec/dummy/config/initializers/alchemy.rb +0 -3
  118. data/spec/dummy/config/initializers/assets.rb +0 -11
  119. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  120. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  121. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  122. data/spec/dummy/config/initializers/inflections.rb +0 -16
  123. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  124. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  125. data/spec/dummy/config/initializers/session_store.rb +0 -3
  126. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  127. data/spec/dummy/config/locales/kl.yml +0 -2
  128. data/spec/dummy/config/routes.rb +0 -12
  129. data/spec/dummy/config/secrets.yml +0 -22
  130. data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -20
  131. data/spec/dummy/db/migrate/20130328101418_create_locations.rb +0 -9
  132. data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -1
  133. data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +0 -1
  134. data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +0 -1
  135. data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +0 -1
  136. data/spec/dummy/db/migrate/20131209225243_create_dummy_users.rb +0 -9
  137. data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +0 -31
  138. data/spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb +0 -20
  139. data/spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +0 -15
  140. data/spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb +0 -10
  141. data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +0 -7
  142. data/spec/dummy/db/migrate/20150608204610_add_parent_element_id_to_alchemy_elements.rb +0 -1
  143. data/spec/dummy/db/migrate/20150729151825_add_link_text_to_alchemy_essence_files.rb +0 -1
  144. data/spec/dummy/db/migrate/20150906195818_add_locale_to_alchemy_languages.rb +0 -1
  145. data/spec/dummy/db/schema.rb +0 -326
  146. data/spec/dummy/db/seeds.rb +0 -1
  147. data/spec/dummy/lib/assets/.gitkeep +0 -0
  148. data/spec/dummy/public/404.html +0 -67
  149. data/spec/dummy/public/422.html +0 -67
  150. data/spec/dummy/public/500.html +0 -66
  151. data/spec/dummy/public/favicon.ico +0 -0
  152. data/spec/dummy/spec/javascripts +0 -1
  153. data/spec/factories.rb +0 -13
  154. data/spec/features/admin/admin_layout_spec.rb +0 -14
  155. data/spec/features/admin/dashboard_spec.rb +0 -81
  156. data/spec/features/admin/edit_elements_feature_spec.rb +0 -36
  157. data/spec/features/admin/language_tree_feature_spec.rb +0 -32
  158. data/spec/features/admin/languages_features_spec.rb +0 -65
  159. data/spec/features/admin/legacy_page_url_management_spec.rb +0 -62
  160. data/spec/features/admin/link_overlay_spec.rb +0 -53
  161. data/spec/features/admin/locale_select_feature_spec.rb +0 -25
  162. data/spec/features/admin/modules_integration_spec.rb +0 -23
  163. data/spec/features/admin/navigation_feature_spec.rb +0 -22
  164. data/spec/features/admin/page_creation_feature_spec.rb +0 -51
  165. data/spec/features/admin/page_editing_feature_spec.rb +0 -135
  166. data/spec/features/admin/picture_library_integration_spec.rb +0 -62
  167. data/spec/features/admin/resources_integration_spec.rb +0 -128
  168. data/spec/features/admin/site_select_feature_spec.rb +0 -31
  169. data/spec/features/admin/tinymce_feature_spec.rb +0 -33
  170. data/spec/features/navigation_spec.rb +0 -9
  171. data/spec/features/page_feature_spec.rb +0 -186
  172. data/spec/features/page_redirects_spec.rb +0 -358
  173. data/spec/features/picture_security_spec.rb +0 -29
  174. data/spec/features/security_spec.rb +0 -24
  175. data/spec/features/translation_integration_spec.rb +0 -51
  176. data/spec/fixtures/500x500.png +0 -0
  177. data/spec/fixtures/80x60.png +0 -0
  178. data/spec/fixtures/animated.gif +0 -0
  179. data/spec/fixtures/image with spaces.png +0 -0
  180. data/spec/fixtures/image.png +0 -0
  181. data/spec/fixtures/image2.PNG +0 -0
  182. data/spec/fixtures/image3.jpeg +0 -0
  183. data/spec/helpers/alchemy/admin/attachments_helper_spec.rb +0 -15
  184. data/spec/helpers/alchemy/admin/base_helper_spec.rb +0 -280
  185. data/spec/helpers/alchemy/admin/contents_helper_spec.rb +0 -46
  186. data/spec/helpers/alchemy/admin/elements_helper_spec.rb +0 -314
  187. data/spec/helpers/alchemy/admin/essences_helper_spec.rb +0 -201
  188. data/spec/helpers/alchemy/admin/navigation_helper_spec.rb +0 -294
  189. data/spec/helpers/alchemy/admin/pages_helper_spec.rb +0 -63
  190. data/spec/helpers/alchemy/admin/pictures_helper_spec.rb +0 -28
  191. data/spec/helpers/alchemy/admin/tags_helper_spec.rb +0 -111
  192. data/spec/helpers/alchemy/base_helper_spec.rb +0 -44
  193. data/spec/helpers/alchemy/elements_block_helper_spec.rb +0 -135
  194. data/spec/helpers/alchemy/elements_helper_spec.rb +0 -326
  195. data/spec/helpers/alchemy/essences_helper_spec.rb +0 -85
  196. data/spec/helpers/alchemy/pages_helper_spec.rb +0 -499
  197. data/spec/helpers/alchemy/picture_url_helpers_spec.rb +0 -78
  198. data/spec/helpers/alchemy/url_helper_spec.rb +0 -200
  199. data/spec/javascripts/alchemy/dialog_spec.coffee +0 -82
  200. data/spec/javascripts/alchemy/link_overlay_spec.coffee +0 -25
  201. data/spec/javascripts/alchemy_integration_spec.coffee +0 -3
  202. data/spec/javascripts/fixtures/select.html +0 -3
  203. data/spec/javascripts/helpers/mock-ajax.js +0 -199
  204. data/spec/javascripts/helpers/test_responses/test_responses.js +0 -1
  205. data/spec/javascripts/support/jasmine.yml +0 -29
  206. data/spec/libraries/auth_accessors_spec.rb +0 -40
  207. data/spec/libraries/config_spec.rb +0 -111
  208. data/spec/libraries/controller_actions_spec.rb +0 -133
  209. data/spec/libraries/i18n_spec.rb +0 -37
  210. data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +0 -30
  211. data/spec/libraries/modules_spec.rb +0 -67
  212. data/spec/libraries/mount_point_spec.rb +0 -77
  213. data/spec/libraries/page_layout_spec.rb +0 -150
  214. data/spec/libraries/paths_spec.rb +0 -15
  215. data/spec/libraries/permissions_spec.rb +0 -260
  216. data/spec/libraries/resource_spec.rb +0 -344
  217. data/spec/libraries/resources_helper_spec.rb +0 -193
  218. data/spec/libraries/shell_spec.rb +0 -121
  219. data/spec/libraries/template_tracker_spec.rb +0 -85
  220. data/spec/libraries/tinymce_spec.rb +0 -111
  221. data/spec/libraries/userstamp_spec.rb +0 -10
  222. data/spec/mailers/alchemy/messages_spec.rb +0 -21
  223. data/spec/models/alchemy/attachment_spec.rb +0 -250
  224. data/spec/models/alchemy/cell_spec.rb +0 -101
  225. data/spec/models/alchemy/content_spec.rb +0 -513
  226. data/spec/models/alchemy/element_spec.rb +0 -862
  227. data/spec/models/alchemy/element_to_page_spec.rb +0 -13
  228. data/spec/models/alchemy/essence_boolean_spec.rb +0 -10
  229. data/spec/models/alchemy/essence_date_spec.rb +0 -28
  230. data/spec/models/alchemy/essence_file_spec.rb +0 -40
  231. data/spec/models/alchemy/essence_html_spec.rb +0 -18
  232. data/spec/models/alchemy/essence_link_spec.rb +0 -10
  233. data/spec/models/alchemy/essence_picture_spec.rb +0 -255
  234. data/spec/models/alchemy/essence_richtext_spec.rb +0 -23
  235. data/spec/models/alchemy/essence_select_spec.rb +0 -10
  236. data/spec/models/alchemy/essence_text_spec.rb +0 -110
  237. data/spec/models/alchemy/language_spec.rb +0 -243
  238. data/spec/models/alchemy/legacy_page_url_spec.rb +0 -21
  239. data/spec/models/alchemy/message_spec.rb +0 -55
  240. data/spec/models/alchemy/page_spec.rb +0 -2108
  241. data/spec/models/alchemy/picture_spec.rb +0 -418
  242. data/spec/models/alchemy/site_spec.rb +0 -168
  243. data/spec/models/alchemy/tag_spec.rb +0 -29
  244. data/spec/models/dummy_model_spec.rb +0 -10
  245. data/spec/requests/alchemy/admin/resources_requests_spec.rb +0 -26
  246. data/spec/requests/alchemy/admin/site_requests_spec.rb +0 -19
  247. data/spec/requests/alchemy/site_requests_spec.rb +0 -18
  248. data/spec/requests/alchemy/sitemap_spec.rb +0 -56
  249. data/spec/routing/api_routing_spec.rb +0 -150
  250. data/spec/routing/routing_spec.rb +0 -340
  251. data/spec/spec_helper.rb +0 -90
  252. data/spec/support/ci/install_phantomjs +0 -7
  253. data/spec/support/hint_examples.rb +0 -28
  254. data/spec/support/test_tweaks.rb +0 -31
  255. data/spec/support/transformation_examples.rb +0 -179
  256. data/spec/tasks/helpers_spec.rb +0 -217
  257. data/spec/views/admin/pictures/show_spec.rb +0 -43
  258. data/spec/views/essences/essence_boolean_editor_spec.rb +0 -32
  259. data/spec/views/essences/essence_boolean_view_spec.rb +0 -23
  260. data/spec/views/essences/essence_date_view_spec.rb +0 -38
  261. data/spec/views/essences/essence_file_editor_spec.rb +0 -59
  262. data/spec/views/essences/essence_file_view_spec.rb +0 -77
  263. data/spec/views/essences/essence_html_view_spec.rb +0 -22
  264. data/spec/views/essences/essence_link_view_spec.rb +0 -41
  265. data/spec/views/essences/essence_picture_editor_spec.rb +0 -80
  266. data/spec/views/essences/essence_picture_view_spec.rb +0 -128
  267. data/spec/views/essences/essence_richtext_view_spec.rb +0 -32
  268. data/spec/views/essences/essence_select_view_spec.rb +0 -11
  269. data/spec/views/essences/essence_text_view_spec.rb +0 -51
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- describe Tag do
5
- describe '.replace' do
6
- let(:picture) { Picture.new }
7
- let(:element) { Element.new }
8
- let(:tag) { Tag.new(name: 'red') }
9
- let(:new_tag) { Tag.new(name: 'green') }
10
-
11
- before do
12
- allow(picture).to receive(:tag_list).and_return(['red'])
13
- allow(element).to receive(:tag_list).and_return(['red'])
14
- allow(picture).to receive(:save).and_return(true)
15
- allow(element).to receive(:save).and_return(true)
16
- allow(tag).to receive(:taggings).and_return([
17
- mock_model(ActsAsTaggableOn::Tagging, taggable: picture),
18
- mock_model(ActsAsTaggableOn::Tagging, taggable: element)
19
- ])
20
- end
21
-
22
- it "should replace given tag with new one on all models tagged with tag" do
23
- Tag.replace(tag, new_tag)
24
- expect(picture.tag_list).to eq(['green'])
25
- expect(element.tag_list).to eq(['green'])
26
- end
27
- end
28
- end
29
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'A User-defined Essence' do
4
- describe DummyModel do
5
- it_behaves_like "an essence" do
6
- let(:essence) { DummyModel.new }
7
- let(:ingredient_value) { "Some String" }
8
- end
9
- end
10
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Resource requests' do
4
- describe 'csv export' do
5
- it 'returns valid csv file' do
6
- get '/admin/events.csv'
7
- expect(response.content_type).to eq(:csv)
8
- expect(response.body).to include(';')
9
- end
10
-
11
- it 'includes id column' do
12
- event = create(:event)
13
- get '/admin/events.csv'
14
- csv = CSV.parse(response.body, col_sep: ";")
15
- expect(csv[0][0]).to eq('Id')
16
- expect(csv[1][0]).to eq(event.id.to_s)
17
- end
18
-
19
- it 'body does not truncate long text columns' do
20
- create(:event, description: '*' * 51)
21
- get '/admin/events.csv'
22
- csv = CSV.parse(response.body, col_sep: ";")
23
- expect(csv[1][7]).to_not include('...')
24
- end
25
- end
26
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Site requests' do
4
- before do
5
- authorize_user(:as_admin)
6
- end
7
-
8
- context 'a site with host' do
9
- let!(:site) { create(:alchemy_site, :public, host: 'alchemy-cms.com') }
10
- let(:another_site) { Alchemy::Site.default }
11
-
12
- context 'in params' do
13
- it 'loads dashboard of another site by id' do
14
- get "http://#{site.host}/admin/dashboard?site_id=#{another_site.id}"
15
- expect(assigns(:current_alchemy_site).id).to eq(another_site.id)
16
- end
17
- end
18
- end
19
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Site requests' do
4
- context 'a site with host' do
5
- let!(:site) { create(:alchemy_site, :public, host: 'alchemy-cms.com') }
6
-
7
- let(:page) do
8
- Alchemy::Site.current = site
9
- root = create(:alchemy_page, :language_root, language: site.languages.last)
10
- create(:alchemy_page, :public, parent: root)
11
- end
12
-
13
- it 'loads this site by host' do
14
- get "http://#{site.host}/#{page.urlname}"
15
- expect(assigns(:current_alchemy_site).host).to eq(site.host)
16
- end
17
- end
18
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Requests for PagesController#sitemap' do
4
- let!(:page) { create(:alchemy_page, :public, sitemap: true) }
5
-
6
- it 'renders valid xml sitemap' do
7
- get '/sitemap.xml'
8
- expect(response.content_type).to eq(:xml)
9
- xml_doc = Nokogiri::XML(response.body)
10
- expect(xml_doc.namespaces).to have_key('xmlns')
11
- expect(xml_doc.namespaces['xmlns']).to eq('http://www.sitemaps.org/schemas/sitemap/0.9')
12
- expect(xml_doc.css('urlset url loc').length).to eq(2)
13
- end
14
-
15
- it 'lastmod dates are ISO 8601 timestamps' do
16
- get '/sitemap.xml'
17
- expect(response.content_type).to eq(:xml)
18
- xml_doc = Nokogiri::XML(response.body)
19
- xml_doc.css('urlset url lastmod').each do |timestamps|
20
- expect(timestamps.text).to match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/)
21
- end
22
- end
23
-
24
- context 'in multi language mode' do
25
- let!(:root) { page.parent }
26
- let!(:pages) { [root, page] }
27
-
28
- before do
29
- allow_any_instance_of(Alchemy::BaseController).to receive('prefix_locale?') { true }
30
- end
31
-
32
- it 'links in sitemap has locale code included' do
33
- get '/sitemap.xml'
34
- xml_doc = Nokogiri::XML(response.body)
35
- xml_doc.css('urlset url').each_with_index do |node, i|
36
- page = pages[i]
37
- expect(node.css('loc').text).to match(/\/#{page.language_code}\//)
38
- end
39
- end
40
-
41
- context 'if the default locale is the page locale' do
42
- before do
43
- allow_any_instance_of(Alchemy::BaseController).to receive('prefix_locale?') { false }
44
- end
45
-
46
- it 'links in sitemap has no locale code included' do
47
- get '/sitemap.xml'
48
- xml_doc = Nokogiri::XML(response.body)
49
- xml_doc.css('urlset url').each_with_index do |node, i|
50
- page = pages[i]
51
- expect(node.css('loc').text).to_not match(/\/#{page.language_code}\//)
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,150 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'The API routes' do
4
- routes { Alchemy::Engine.routes }
5
-
6
- describe "for pages" do
7
- it "has route to show all pages." do
8
- expect({get: "/api/pages.json"}).to route_to(
9
- controller: "alchemy/api/pages",
10
- action: "index",
11
- format: "json"
12
- )
13
- end
14
-
15
- context 'with missing format' do
16
- it "defaults to json." do
17
- expect({get: "/api/pages"}).to route_to(
18
- controller: "alchemy/api/pages",
19
- action: "index",
20
- format: "json"
21
- )
22
- end
23
- end
24
-
25
- it "has route to show a page by urlname." do
26
- expect({get: "/api/pages/a-page.json"}).to route_to(
27
- controller: "alchemy/api/pages",
28
- action: "show",
29
- urlname: "a-page",
30
- format: "json"
31
- )
32
- end
33
-
34
- it "has route to show a page by nested urlname." do
35
- expect({get: "/api/pages/nested/a-page"}).to route_to(
36
- controller: "alchemy/api/pages",
37
- action: "show",
38
- urlname: "nested/a-page",
39
- format: "json"
40
- )
41
- end
42
-
43
- context 'with admin namespace' do
44
- it "routes to api pages controller." do
45
- expect({get: "/api/admin/pages/8"}).to route_to(
46
- controller: "alchemy/api/pages",
47
- action: "show",
48
- id: "8",
49
- format: "json"
50
- )
51
- end
52
- end
53
- end
54
-
55
- describe 'for elements' do
56
- it "has route to show all elements." do
57
- expect({get: "/api/elements.json"}).to route_to(
58
- controller: "alchemy/api/elements",
59
- action: "index",
60
- format: "json"
61
- )
62
- end
63
-
64
- context 'with missing format' do
65
- it "defaults to json." do
66
- expect({get: "/api/elements"}).to route_to(
67
- controller: "alchemy/api/elements",
68
- action: "index",
69
- format: "json"
70
- )
71
- end
72
- end
73
-
74
- it "has route to show all elements for page id." do
75
- expect({get: "/api/pages/1/elements.json"}).to route_to(
76
- controller: "alchemy/api/elements",
77
- action: "index",
78
- page_id: "1",
79
- format: "json"
80
- )
81
- end
82
-
83
- it "has route to show all elements for page id and name." do
84
- expect({get: "/api/pages/1/elements/article.json"}).to route_to(
85
- controller: "alchemy/api/elements",
86
- action: "index",
87
- page_id: "1",
88
- named: "article",
89
- format: "json"
90
- )
91
- end
92
-
93
- it "has route to show an element." do
94
- expect({get: "/api/elements/1.json"}).to route_to(
95
- controller: "alchemy/api/elements",
96
- action: "show",
97
- id: "1",
98
- format: "json"
99
- )
100
- end
101
- end
102
-
103
- describe 'for contents' do
104
- it "has route to show all contents." do
105
- expect({get: "/api/contents.json"}).to route_to(
106
- controller: "alchemy/api/contents",
107
- action: "index",
108
- format: "json"
109
- )
110
- end
111
-
112
- context 'with missing format' do
113
- it "defaults to json." do
114
- expect({get: "/api/contents"}).to route_to(
115
- controller: "alchemy/api/contents",
116
- action: "index",
117
- format: "json"
118
- )
119
- end
120
- end
121
-
122
- it "has route to show all contents for element id." do
123
- expect({get: "/api/elements/1/contents.json"}).to route_to(
124
- controller: "alchemy/api/contents",
125
- action: "index",
126
- element_id: "1",
127
- format: "json"
128
- )
129
- end
130
-
131
- it "has route to show all contents for element id and name." do
132
- expect({get: "/api/elements/1/contents/headline.json"}).to route_to(
133
- controller: "alchemy/api/contents",
134
- action: "show",
135
- element_id: "1",
136
- name: "headline",
137
- format: "json"
138
- )
139
- end
140
-
141
- it "has route to show a content." do
142
- expect({get: "/api/contents/1.json"}).to route_to(
143
- controller: "alchemy/api/contents",
144
- action: "show",
145
- id: "1",
146
- format: "json"
147
- )
148
- end
149
- end
150
- end
@@ -1,340 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "The Routing" do
4
- routes { Alchemy::Engine.routes }
5
-
6
- describe "root url" do
7
- it "routes to pages_controller#index" do
8
- expect({
9
- get: "/"
10
- }).to route_to(
11
- controller: "alchemy/pages",
12
- action: "index"
13
- )
14
- end
15
-
16
- context 'with locale parameter' do
17
- it 'routes to pages_controller#index' do
18
- expect({
19
- get: '/en'
20
- }).to route_to(
21
- controller: 'alchemy/pages',
22
- action: 'index',
23
- locale: 'en'
24
- )
25
- end
26
-
27
- context 'that contains uppercase country code' do
28
- it 'routes to pages_controller#index' do
29
- expect({
30
- get: '/en-UK'
31
- }).to route_to(
32
- controller: 'alchemy/pages',
33
- action: 'index',
34
- locale: 'en-UK'
35
- )
36
- end
37
- end
38
- end
39
- end
40
-
41
- context "for downloads" do
42
- it "should have a named route" do
43
- expect({
44
- get: "/attachment/32/download/Presseveranstaltung.pdf"
45
- }).to route_to(
46
- controller: "alchemy/attachments",
47
- action: "download",
48
- id: "32",
49
- name: "Presseveranstaltung",
50
- format: "pdf"
51
- )
52
- end
53
- end
54
-
55
- describe "nested url" do
56
- context "one level deep nested" do
57
- it "should route to pages show" do
58
- expect({
59
- get: "/products/my-product"
60
- }).to route_to(
61
- controller: "alchemy/pages",
62
- action: "show",
63
- urlname: "products/my-product"
64
- )
65
- end
66
-
67
- context "and language" do
68
- it "should route to pages show" do
69
- expect({
70
- get: "/de/products/my-product"
71
- }).to route_to(
72
- controller: "alchemy/pages",
73
- action: "show",
74
- urlname: "products/my-product",
75
- locale: "de"
76
- )
77
- end
78
- end
79
- end
80
-
81
- context "two levels deep nested" do
82
- it "should route to pages show" do
83
- expect({
84
- get: "/catalog/products/my-product"
85
- }).to route_to(
86
- controller: "alchemy/pages",
87
- action: "show",
88
- urlname: "catalog/products/my-product"
89
- )
90
- end
91
-
92
- context "and language" do
93
- it "should route to pages show" do
94
- expect({
95
- get: "/de/catalog/products/my-product"
96
- }).to route_to(
97
- controller: "alchemy/pages",
98
- action: "show",
99
- urlname: "catalog/products/my-product",
100
- locale: "de"
101
- )
102
- end
103
- end
104
- end
105
-
106
- context "with a blog date url" do
107
- it "should route to pages show" do
108
- expect({
109
- get: "/2011/12/08/my-post"
110
- }).to route_to(
111
- controller: "alchemy/pages",
112
- action: "show",
113
- urlname: "2011/12/08/my-post"
114
- )
115
- end
116
-
117
- context "and language" do
118
- it "should route to pages show" do
119
- expect({
120
- get: "/de/2011/12/08/my-post"
121
- }).to route_to(
122
- controller: "alchemy/pages",
123
- action: "show",
124
- urlname: "2011/12/08/my-post",
125
- locale: "de"
126
- )
127
- end
128
- end
129
- end
130
- end
131
-
132
- describe "for displaying pictures" do
133
- it "should route to show action" do
134
- expect({
135
- get: "/pictures/3/show/900x300/kitten.jpg"
136
- }).to route_to(
137
- controller: "alchemy/pictures",
138
- action: "show",
139
- id: "3",
140
- size: "900x300",
141
- name: "kitten",
142
- format: "jpg"
143
- )
144
- end
145
-
146
- it "should route to cropped show action" do
147
- expect({
148
- get: "/pictures/3/show/900x300/crop/kitten.jpg"
149
- }).to route_to(
150
- controller: "alchemy/pictures",
151
- action: "show",
152
- id: "3",
153
- size: "900x300",
154
- crop: "crop",
155
- name: "kitten",
156
- format: "jpg"
157
- )
158
- end
159
-
160
- it "should route to cropped mask show action" do
161
- expect(
162
- get("/pictures/3/show/300x300/crop/200x50/100x100/kitten.jpg")
163
- ).to route_to(
164
- controller: "alchemy/pictures",
165
- action: "show",
166
- id: "3",
167
- size: "300x300",
168
- crop: "crop",
169
- crop_from: "200x50",
170
- crop_size: "100x100",
171
- name: "kitten",
172
- format: "jpg"
173
- )
174
- end
175
-
176
- it "should route to thumbnail action" do
177
- expect(
178
- get("/pictures/3/thumbnails/small/kitten.jpg")
179
- ).to route_to(
180
- controller: "alchemy/pictures",
181
- action: "thumbnail",
182
- id: "3",
183
- size: "small",
184
- name: "kitten",
185
- format: "jpg"
186
- )
187
- end
188
-
189
- it "should route to cropped thumbnail action" do
190
- expect(
191
- get("/pictures/3/thumbnails/small/crop/kitten.jpg")
192
- ).to route_to(
193
- controller: "alchemy/pictures",
194
- action: "thumbnail",
195
- id: "3",
196
- crop: "crop",
197
- size: "small",
198
- name: "kitten",
199
- format: "jpg"
200
- )
201
- end
202
-
203
- it "should route to cropped and masked thumbnail" do
204
- expect(
205
- get("/pictures/3/thumbnails/small/0x0/200x200/kitten.jpg")
206
- ).to route_to(
207
- controller: "alchemy/pictures",
208
- action: "thumbnail",
209
- id: "3",
210
- crop_from: "0x0",
211
- crop_size: "200x200",
212
- size: "small",
213
- name: "kitten",
214
- format: "jpg"
215
- )
216
- end
217
-
218
- it "should route to zoomed picture" do
219
- expect(
220
- get("/pictures/3/zoom/kitten.jpg")
221
- ).to route_to(
222
- controller: "alchemy/pictures",
223
- action: "zoom",
224
- id: "3",
225
- name: "kitten",
226
- format: "jpg"
227
- )
228
- end
229
- end
230
-
231
- describe "image format requests" do
232
- it "should not be handled by alchemy/pages controller" do
233
- expect({
234
- get: "/products/my-product.jpg"
235
- }).not_to be_routable
236
- end
237
- end
238
-
239
- describe "rss feed requests" do
240
- it "should be handled by alchemy/pages controller" do
241
- expect({
242
- get: "/news.rss"
243
- }).to route_to(
244
- controller: "alchemy/pages",
245
- action: "show",
246
- urlname: "news",
247
- format: "rss"
248
- )
249
- end
250
- end
251
-
252
- describe "unknown formats" do
253
- it "should be handled by alchemy/pages controller" do
254
- expect({
255
- get: "/index.php?id=234"
256
- }).to route_to(
257
- controller: "alchemy/pages",
258
- action: "show",
259
- urlname: "index",
260
- format: "php",
261
- id: "234"
262
- )
263
-
264
- expect({
265
- get: "/action.do"
266
- }).to route_to(
267
- controller: "alchemy/pages",
268
- action: "show",
269
- urlname: "action",
270
- format: "do"
271
- )
272
- end
273
- end
274
-
275
- describe "Rails info requests" do
276
- it "should not be handled by alchemy/pages controller" do
277
- expect({
278
- get: "/rails/info/routes"
279
- }).not_to be_routable
280
- end
281
- end
282
-
283
- context "for admin interface" do
284
- context "default" do
285
- it "should route to admin dashboard" do
286
- expect({
287
- get: "/admin/dashboard"
288
- }).to route_to(
289
- controller: "alchemy/admin/dashboard",
290
- action: "index"
291
- )
292
- end
293
-
294
- it "should route to page preview" do
295
- expect({
296
- get: "/admin/pages/3/preview"
297
- }).to route_to(
298
- controller: "alchemy/admin/pages",
299
- action: "preview",
300
- id: "3"
301
- )
302
- end
303
- end
304
-
305
- context "customized" do
306
- before(:all) do
307
- Alchemy.admin_path = "/backend"
308
- Alchemy.admin_constraints = {subdomain: "hidden"}
309
- Rails.application.reload_routes!
310
- end
311
-
312
- it "should route to admin dashboard" do
313
- expect({
314
- get: "http://hidden.example.org/backend/dashboard"
315
- }).to route_to(
316
- controller: "alchemy/admin/dashboard",
317
- action: "index",
318
- subdomain: "hidden"
319
- )
320
- end
321
-
322
- it "should route to page preview" do
323
- expect({
324
- get: "http://hidden.example.org/backend/pages/3/preview"
325
- }).to route_to(
326
- controller: "alchemy/admin/pages",
327
- action: "preview",
328
- id: "3",
329
- subdomain: "hidden"
330
- )
331
- end
332
-
333
- after(:all) do
334
- Alchemy.admin_path = "/admin"
335
- Alchemy.admin_constraints = {}
336
- Rails.application.reload_routes!
337
- end
338
- end
339
- end
340
- end