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,294 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Alchemy::Admin::NavigationHelper do
4
- let(:alchemy_module) do
5
- {
6
- 'name' => 'dashboard',
7
- 'engine_name' => 'alchemy',
8
- 'navigation' => {
9
- 'name' => 'modules.dashboard',
10
- 'controller' => 'alchemy/admin/dashboard',
11
- 'action' => 'index',
12
- 'icon' => 'dashboard',
13
- 'sub_navigation' => [{
14
- 'controller' => 'alchemy/admin/layoutpages',
15
- 'action' => 'index'
16
- }]
17
- }
18
- }
19
- end
20
-
21
- let(:event_module) do
22
- {
23
- 'navigation' => {
24
- 'controller' => '/admin/events',
25
- 'action' => 'index',
26
- 'sub_navigation' => [{
27
- 'controller' => '/admin/events',
28
- 'action' => 'index'
29
- }]
30
- }
31
- }
32
- end
33
-
34
- let(:event_module_with_params) do
35
- {
36
- 'navigation' => {
37
- 'controller' => '/admin/events',
38
- 'action' => 'index',
39
- 'params' => {
40
- 'key' => 'value'
41
- },
42
- 'sub_navigation' => [{
43
- 'controller' => '/admin/events',
44
- 'action' => 'index',
45
- 'params' => {
46
- 'key' => 'value',
47
- 'key2' => 'value2'
48
- }
49
- }]
50
- }
51
- }
52
- end
53
-
54
- let(:navigation) { alchemy_module['navigation'] }
55
-
56
- describe '#alchemy_main_navigation_entry' do
57
- before do
58
- allow(helper).to receive(:url_for_module).and_return('')
59
- allow(Alchemy).to receive(:t).and_return(alchemy_module['name'])
60
- end
61
-
62
- context "with permission" do
63
- before do
64
- expect(helper).to receive(:can?).and_return(true)
65
- end
66
-
67
- it "renders the main navigation entry partial" do
68
- expect(helper.alchemy_main_navigation_entry(alchemy_module)).to match /<a.+class="main_navi_entry/
69
- end
70
- end
71
-
72
- context "without permission" do
73
- before do
74
- allow(helper).to receive(:can?).and_return(false)
75
- end
76
-
77
- it "returns empty string" do
78
- expect(helper.alchemy_main_navigation_entry(alchemy_module)).to be_empty
79
- end
80
- end
81
- end
82
-
83
- describe '#admin_subnavigation' do
84
- before do
85
- allow(helper).to receive(:current_alchemy_module).and_return(alchemy_module)
86
- allow(helper).to receive(:url_for_module_sub_navigation).and_return('')
87
- allow(Alchemy).to receive(:t).and_return(alchemy_module['name'])
88
- end
89
-
90
- context "with permission" do
91
- before do
92
- expect(helper).to receive(:can?).and_return(true)
93
- end
94
-
95
- it "renders the sub navigation for current module" do
96
- expect(helper.admin_subnavigation).to match /<div.+class="subnavi_tab/
97
- end
98
- end
99
-
100
- context "without permission" do
101
- before do
102
- expect(helper).to receive(:can?).and_return(false)
103
- end
104
-
105
- it "renders the sub navigation for current module" do
106
- expect(helper.admin_subnavigation).to be_empty
107
- end
108
- end
109
-
110
- context "without a module present" do
111
- before do
112
- expect(helper).to receive(:current_alchemy_module).and_return(nil)
113
- end
114
-
115
- it "returns nil" do
116
- expect(helper.admin_subnavigation).to be_nil
117
- end
118
- end
119
- end
120
-
121
- describe '#navigate_module' do
122
- it "returns array with symbolized action and controller name" do
123
- expect(helper.navigate_module(navigation)).to eq([:index, :alchemy_admin_dashboard])
124
- end
125
-
126
- it "stringifies keys" do
127
- expect(helper.navigate_module({action: 'index', controller: 'alchemy/admin/pictures'})).to eq([:index, :alchemy_admin_pictures])
128
- end
129
-
130
- it "removes leading slash" do
131
- expect(helper.navigate_module({action: 'index', controller: '/admin/pictures'})).to eq([:index, :admin_pictures])
132
- end
133
- end
134
-
135
- describe '#main_navigation_css_classes' do
136
- it "returns string with css classes for main navigation entry" do
137
- expect(helper.main_navigation_css_classes(navigation)).to eq("main_navi_entry")
138
- end
139
-
140
- context "with active entry" do
141
- before do
142
- allow(helper).to receive(:params).and_return({
143
- controller: 'alchemy/admin/dashboard',
144
- action: 'index'
145
- })
146
- end
147
-
148
- it "includes active class" do
149
- expect(helper.main_navigation_css_classes(navigation)).to eq("main_navi_entry active")
150
- end
151
- end
152
- end
153
-
154
- describe '#entry_active?' do
155
- let(:entry) do
156
- {'controller' => 'alchemy/admin/dashboard', 'action' => 'index'}
157
- end
158
-
159
- context "with active entry" do
160
- before do
161
- allow(helper).to receive(:params).and_return({
162
- controller: 'alchemy/admin/dashboard',
163
- action: 'index'
164
- })
165
- end
166
-
167
- it "returns true" do
168
- expect(helper.entry_active?(entry)).to be_truthy
169
- end
170
-
171
- context "and with leading slash in controller name" do
172
- before { entry['controller'] = '/alchemy/admin/dashboard' }
173
-
174
- it "returns true" do
175
- expect(helper.entry_active?(entry)).to be_truthy
176
- end
177
- end
178
-
179
- context "but with action listed in nested_actions key" do
180
- before do
181
- entry['action'] = nil
182
- entry['nested_actions'] = %w(index)
183
- end
184
-
185
- it "returns true" do
186
- expect(helper.entry_active?(entry)).to be_truthy
187
- end
188
- end
189
- end
190
-
191
- context "with inactive entry" do
192
- before do
193
- expect(helper).to receive(:params).and_return({
194
- controller: 'alchemy/admin/users',
195
- action: 'index'
196
- })
197
- end
198
-
199
- it "returns false" do
200
- expect(helper.entry_active?(entry)).to be_falsey
201
- end
202
- end
203
- end
204
-
205
- describe '#url_for_module' do
206
- context "with module within an engine" do
207
- it "returns correct url string" do
208
- expect(helper.url_for_module(alchemy_module)).to eq('/admin/dashboard')
209
- end
210
- end
211
-
212
- context "with module within host app" do
213
- it "returns correct url string" do
214
- expect(helper.url_for_module(event_module)).to eq('/admin/events')
215
- end
216
-
217
- it "returns correct url string with params" do
218
- expect(helper.url_for_module(event_module_with_params)).to eq('/admin/events?key=value')
219
- end
220
- end
221
- end
222
-
223
- describe '#url_for_module_sub_navigation' do
224
- subject { helper.url_for_module_sub_navigation(navigation) }
225
-
226
- let(:current_module) { alchemy_module }
227
- let(:navigation) { current_module['navigation']['sub_navigation'].first }
228
-
229
- context 'with module found' do
230
- before do
231
- expect(helper).to receive(:module_definition_for).and_return current_module
232
- end
233
-
234
- context "with module within an engine" do
235
- let(:current_module) { alchemy_module }
236
-
237
- it "returns correct url string" do
238
- is_expected.to eq('/admin/layoutpages')
239
- end
240
- end
241
-
242
- context "with module within host app" do
243
- let(:current_module) { event_module }
244
-
245
- it "returns correct url string" do
246
- is_expected.to eq('/admin/events')
247
- end
248
- end
249
-
250
- context "with module within host app with params" do
251
- let(:current_module) { event_module_with_params }
252
-
253
- it "returns correct url string with params" do
254
- is_expected.to eq('/admin/events?key2=value2&key=value')
255
- end
256
- end
257
- end
258
-
259
- context 'without module found' do
260
- before do
261
- expect(helper).to receive(:module_definition_for).and_return nil
262
- end
263
-
264
- it { is_expected.to be_nil }
265
- end
266
- end
267
-
268
- describe "#sorted_alchemy_modules" do
269
- subject { helper.sorted_alchemy_modules }
270
-
271
- context 'with position attribute on modules' do
272
- before do
273
- alchemy_module['position'] = 1
274
- event_module['position'] = 2
275
- expect(helper).to receive(:alchemy_modules).and_return [event_module, alchemy_module]
276
- end
277
-
278
- it "returns sorted alchemy modules" do
279
- is_expected.to eq([alchemy_module, event_module])
280
- end
281
- end
282
-
283
- context 'with no position attribute on one module' do
284
- before do
285
- event_module['position'] = 2
286
- expect(helper).to receive(:alchemy_modules).and_return [alchemy_module, event_module]
287
- end
288
-
289
- it "appends this module at the end" do
290
- is_expected.to eq([event_module, alchemy_module])
291
- end
292
- end
293
- end
294
- end
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Alchemy::Admin::PagesHelper do
4
-
5
- describe '#preview_sizes_for_select' do
6
- it "returns a options string of preview screen sizes for select tag" do
7
- expect(helper.preview_sizes_for_select).to include('option', 'auto', '240', '320', '480', '768', '1024', '1280')
8
- end
9
- end
10
-
11
- describe '#combined_page_status' do
12
- let(:page) { build_stubbed(:alchemy_page, restricted: true, visible: true, public: true, locked: true) }
13
- subject { helper.combined_page_status(page) }
14
-
15
- context 'when page is locked' do
16
- it { is_expected.not_to match(/locked/) } # We don't want the locked status in the return string
17
- end
18
-
19
- context 'when page is restricted' do
20
- it { is_expected.to match(/is restricted/) }
21
- end
22
-
23
- context 'when page is visible in navigation' do
24
- it { is_expected.to match(/is visible/) }
25
- end
26
-
27
- context 'when page is published' do
28
- it { is_expected.to match(/is published/) }
29
- end
30
- end
31
-
32
- describe '#page_layout_label' do
33
- let(:page) { build(:alchemy_page) }
34
-
35
- subject { helper.page_layout_label(page) }
36
-
37
- context 'when page is not yet persisted' do
38
- it 'displays text only' do
39
- is_expected.to eq(Alchemy.t(:page_type))
40
- end
41
- end
42
-
43
- context 'when page is persited' do
44
- before { page.save! }
45
-
46
- context 'with page layout existing' do
47
- it 'displays text only' do
48
- is_expected.to eq(Alchemy.t(:page_type))
49
- end
50
- end
51
-
52
- context 'with page layout definition missing' do
53
- before do
54
- expect(page).to receive(:definition).and_return([])
55
- end
56
-
57
- it 'displays icon with warning' do
58
- is_expected.to match /warning icon/
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Alchemy::Admin::PicturesHelper do
4
- describe "#create_or_assign_url" do
5
- let(:picture) { mock_model('Picture') }
6
- let(:options) { Hash.new }
7
-
8
- before { @element = mock_model('Element') }
9
-
10
- it "should return a Hash" do
11
- expect(helper.create_or_assign_url(picture, options)).to be_a(Hash)
12
- end
13
-
14
- context "when creating" do
15
- it "should include 'create' as the value for the action key" do
16
- expect(helper.create_or_assign_url(picture, options)[:action]).to be(:create)
17
- end
18
- end
19
-
20
- context "when assigning" do
21
- before { @content = mock_model('Content') }
22
-
23
- it "should include 'assign' as the value for the action key" do
24
- expect(helper.create_or_assign_url(picture, options)[:action]).to be(:assign)
25
- end
26
- end
27
- end
28
- end
@@ -1,111 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- describe Admin::TagsHelper do
5
- let(:tag) { mock_model(ActsAsTaggableOn::Tag, name: 'foo', count: 1) }
6
- let(:tag2) { mock_model(ActsAsTaggableOn::Tag, name: 'abc', count: 1) }
7
- let(:params) { {controller: 'admin/attachments', action: 'index', use_route: 'alchemy', tagged_with: 'foo'} }
8
-
9
- describe '#render_tag_list' do
10
- context "with tagged objects" do
11
- before { allow(Attachment).to receive(:tag_counts).and_return([tag, tag2]) }
12
-
13
- it "returns a tag list as <li> tags" do
14
- expect(helper.render_tag_list('Alchemy::Attachment', params)).to match(/li/)
15
- end
16
-
17
- it "has the tags name in the li's name attribute" do
18
- expect(helper.render_tag_list('Alchemy::Attachment', params)).to match(/li.+name="#{tag.name}"/)
19
- end
20
-
21
- it "has active class if tag is present in params" do
22
- expect(helper.render_tag_list('Alchemy::Attachment', params)).to match(/li.+class="active"/)
23
- end
24
-
25
- it "tags are sorted alphabetically" do
26
- expect(helper.render_tag_list('Alchemy::Attachment', params)).to match(/li.+name="#{tag2.name}.+li.+name="#{tag.name}/)
27
- end
28
-
29
- context "with lowercase and uppercase tag names mixed" do
30
- let(:tag) { mock_model(ActsAsTaggableOn::Tag, name: 'Foo', count: 1) }
31
-
32
- it "tags are sorted alphabetically correctly" do
33
- expect(helper.render_tag_list('Alchemy::Attachment', params)).to match(/li.+name="#{tag2.name}.+li.+name="#{tag.name}/)
34
- end
35
- end
36
-
37
- it "output is html_safe" do
38
- expect(helper.render_tag_list('Alchemy::Attachment', params).html_safe?).to be_truthy
39
- end
40
- end
41
-
42
- context "without any tagged objects" do
43
- it "returns empty string" do
44
- expect(render_tag_list('Alchemy::Attachment', params)).to be_empty
45
- end
46
- end
47
-
48
- context "with nil given as class_name parameter" do
49
- it "raises argument error" do
50
- expect { render_tag_list(nil, params) }.to raise_error(ArgumentError)
51
- end
52
- end
53
- end
54
-
55
- describe '#tag_list_tag_active?' do
56
- context "the tag is in params" do
57
- it "returns true" do
58
- expect(tag_list_tag_active?(tag, params)).to be_truthy
59
- end
60
- end
61
-
62
- context "params[:tagged_with] is not present" do
63
- it "returns false" do
64
- expect(tag_list_tag_active?(tag, {})).to be_falsey
65
- end
66
- end
67
- end
68
-
69
- describe "#filtered_by_tag?" do
70
- it "should return true if the filterlist contains the given tag" do
71
- controller.params[:tagged_with] = "foo,bar,baz"
72
- expect(helper.filtered_by_tag?(tag)).to eq(true)
73
- end
74
-
75
- it "should return false if the filterlist does not contain the given tag" do
76
- controller.params[:tagged_with] = "bar,baz"
77
- expect(helper.filtered_by_tag?(tag)).to eq(false)
78
- end
79
- end
80
-
81
- describe "#add_to_tag_filter" do
82
- context "if params[:tagged_with] is not present" do
83
- it "should return an Array with the given tag name" do
84
- expect(helper.add_to_tag_filter(tag)).to eq(["foo"])
85
- end
86
- end
87
-
88
- context "if params[:tagged_with] contains some tag names" do
89
- it "should return an Array of tag names including the given one" do
90
- controller.params[:tagged_with] = "bar,baz"
91
- expect(helper.add_to_tag_filter(tag)).to eq(["bar", "baz", "foo"])
92
- end
93
- end
94
- end
95
-
96
- describe "#remove_from_tag_filter" do
97
- context "if params[:tagged_with] is not present" do
98
- it "should return an empty Array" do
99
- expect(helper.remove_from_tag_filter(tag)).to be_empty
100
- end
101
- end
102
-
103
- context "if params[:tagged_with] contains some tag names" do
104
- it "should return an Array of tag names without the given one" do
105
- controller.params[:tagged_with] = "bar,baz,foo"
106
- expect(helper.remove_from_tag_filter(tag)).to eq(["bar", "baz"])
107
- end
108
- end
109
- end
110
- end
111
- end