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,121 +0,0 @@
1
- require 'spec_helper'
2
- require 'alchemy/shell'
3
-
4
- module Alchemy
5
- # Class fixture
6
- class MyToDoList
7
- extend Shell
8
- end
9
-
10
- describe Shell do
11
- before { allow(MyToDoList).to receive(:puts) }
12
-
13
- describe '.todo' do
14
- it "should add given string as a todo by delegating to .add_todo" do
15
- expect(MyToDoList).to receive(:add_todo).with(["", "new todo"])
16
- MyToDoList.todo("new todo")
17
- end
18
- end
19
-
20
- describe '.todos' do
21
- it "should be an Array" do
22
- expect(MyToDoList.todos).to be_a(Array)
23
- end
24
- end
25
-
26
- describe '.add_todo' do
27
- it "should add the given string to the .todos array" do
28
- MyToDoList.add_todo('1')
29
- MyToDoList.add_todo('2')
30
- expect(MyToDoList.todos).to eq(['1', '2'])
31
- end
32
- end
33
-
34
- describe '.display_todos' do
35
- context 'if there are todos in the list' do
36
- before do
37
- allow(MyToDoList).to receive(:todos).and_return(['My first todo', 'My second todo'])
38
- end
39
-
40
- it "should log them" do
41
- expect(MyToDoList).to receive(:log).at_least(1).times
42
- MyToDoList.display_todos
43
- end
44
-
45
- it "should iterate through the todos with an index" do
46
- expect(MyToDoList.todos).to receive(:each_with_index)
47
- MyToDoList.display_todos
48
- end
49
- end
50
-
51
- context 'if there are todos in the list' do
52
- before do
53
- allow(MyToDoList).to receive(:todos).and_return([])
54
- end
55
-
56
- it "should not log anything" do
57
- expect(MyToDoList).not_to receive(:log)
58
- MyToDoList.display_todos
59
- end
60
- end
61
- end
62
-
63
- describe '.log' do
64
- before { Alchemy::Shell.verbose! }
65
-
66
- context 'if the message type is "skip"' do
67
- it "the output color should be yellow and cleared again" do
68
- expect(MyToDoList).to receive(:color).with(:yellow)
69
- expect(MyToDoList).to receive(:color).with(:clear)
70
- MyToDoList.log('in yellow, please', :skip)
71
- end
72
- end
73
-
74
- context 'if the message type is "error"' do
75
- it "the output color should be yellow and cleared again" do
76
- expect(MyToDoList).to receive(:color).with(:red)
77
- expect(MyToDoList).to receive(:color).with(:clear)
78
- MyToDoList.log('in red, please', :error)
79
- end
80
- end
81
-
82
- context 'if the message type is "message"' do
83
- it "the output color should just be cleared" do
84
- expect(MyToDoList).to receive(:color).with(:clear)
85
- MyToDoList.log('cleared, please', :message)
86
- end
87
- end
88
-
89
- context 'if no message type is given' do
90
- it "the output color should be green" do
91
- expect(MyToDoList).to receive(:color).with(:green)
92
- expect(MyToDoList).to receive(:color).with(:clear)
93
- MyToDoList.log('in green, please')
94
- end
95
- end
96
- end
97
-
98
- describe '.color' do
99
- context 'if given name is a constant of Thor::Shell::Color' do
100
- before do
101
- allow(Thor::Shell::Color).to receive(:const_defined?).and_return(true)
102
- end
103
-
104
- it "should call the constant" do
105
- expect_any_instance_of(String).to receive(:constantize).and_return('')
106
- MyToDoList.send(:color, :red)
107
- end
108
- end
109
-
110
- context 'if given name is not a defined constant of Thor::Shell::Color' do
111
- before do
112
- allow(Thor::Shell::Color).to receive(:const_defined?).and_return(false)
113
- end
114
-
115
- it "should return en empty string" do
116
- expect(MyToDoList.send(:color, :not_existing)).to eq('')
117
- end
118
- end
119
- end
120
- end
121
- end
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- module CacheDigests
5
- describe TemplateTracker do
6
- subject { TemplateTracker.call(name, nil) }
7
-
8
- describe '#dependencies' do
9
- context 'with alchemy/pages/show given as template name' do
10
- let(:name) { 'alchemy/pages/show' }
11
- before { allow(PageLayout).to receive(:all).and_return([{'name' => 'intro'}, {'name' => 'contact'}]) }
12
-
13
- it "returns all page layout view partial names" do
14
- is_expected.to include('alchemy/page_layouts/_intro', 'alchemy/page_layouts/_contact')
15
- end
16
- end
17
-
18
- context 'with a page layout given as template name' do
19
- let(:name) { 'alchemy/page_layouts/_intro' }
20
- let(:page_layout) { {'name' => 'intro', 'elements' => ['text']} }
21
- before { allow(PageLayout).to receive(:get).and_return(page_layout) }
22
-
23
- it "returns all element layout view partial names for that layout" do
24
- is_expected.to include('alchemy/elements/_text_view')
25
- end
26
-
27
- context 'and page layout having cells' do
28
- let(:page_layout) { {'name' => 'intro', 'elements' => ['text'], 'cells' => ['header']} }
29
-
30
- it "returns all cell view partial names for that layout" do
31
- is_expected.to include('alchemy/cells/_header')
32
- end
33
- end
34
- end
35
-
36
- context 'with a cell given as template name' do
37
- let(:name) { 'alchemy/cells/_header' }
38
- before { allow(Cell).to receive(:definition_for).and_return({'name' => 'header', 'elements' => ['text']}) }
39
-
40
- it "returns all element layout view partial names for that cell" do
41
- is_expected.to include('alchemy/elements/_text_view')
42
- end
43
- end
44
-
45
- context 'with an element given as name' do
46
- let(:name) { 'alchemy/elements/_text_view' }
47
- let(:elements) { [{'name' => 'text', 'contents' => [{'type' => 'EssenceText'}]}] }
48
-
49
- context 'that is having a definition' do
50
- before { allow(Element).to receive(:definitions).and_return(elements) }
51
-
52
- it "returns all essence layout view partial names for that element" do
53
- is_expected.to include('alchemy/essences/_essence_text_view')
54
- end
55
-
56
- context 'and element has picture_gallery enabled' do
57
- let(:elements) { [{'name' => 'text', 'picture_gallery' => true}] }
58
-
59
- it "has EssencePicture as template dependency" do
60
- is_expected.to include('alchemy/essences/_essence_picture_view')
61
- end
62
- end
63
- end
64
-
65
- context 'that has no definition' do
66
- before { allow(Element).to receive(:definitions).and_return([]) }
67
-
68
- it "returns empty array" do
69
- is_expected.to be_empty
70
- end
71
- end
72
- end
73
-
74
- context 'with not an alchemy template given as name' do
75
- let(:name) { 'shop/cart' }
76
-
77
- it "calls rails template tracker" do
78
- expect(ActionView::DependencyTracker::ERBTracker).to receive(:call).with(name, nil)
79
- subject
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end
@@ -1,111 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- describe Tinymce do
5
- describe '.init' do
6
- subject { Tinymce.init }
7
-
8
- it "returns the default config" do
9
- is_expected.to eq(Tinymce.class_variable_get('@@init'))
10
- end
11
- end
12
-
13
- describe '.init=' do
14
- let(:another_config) { {theme_advanced_buttons3: 'table'} }
15
-
16
- it "merges the default config with given config" do
17
- Tinymce.init = another_config
18
- expect(Tinymce.init).to include(another_config)
19
- end
20
- end
21
-
22
- context 'Methods for contents with custom tinymce config.' do
23
- let(:content_definition) do
24
- {
25
- 'name' => 'text',
26
- 'settings' => {
27
- 'tinymce' => {
28
- 'foo' => 'bar'
29
- }
30
- }
31
- }
32
- end
33
-
34
- let(:element_definition) do
35
- {
36
- 'name' => 'article',
37
- 'contents' => [content_definition]
38
- }
39
- end
40
-
41
- describe '.custom_config_contents' do
42
- subject { Tinymce.custom_config_contents }
43
-
44
- before do
45
- allow(Element).to receive(:definitions).and_return([element_definition])
46
- # Preventing memoization
47
- Tinymce.class_variable_set('@@custom_config_contents', nil)
48
- end
49
-
50
- it "returns an array of content definitions that contain custom tinymce config
51
- and element name" do
52
- is_expected.to be_an(Array)
53
- is_expected.to include({
54
- 'element' => element_definition['name']
55
- }.merge(content_definition))
56
- end
57
-
58
- context 'with no contents having custom tinymce config' do
59
- let(:content_definition) do
60
- {'name' => 'text'}
61
- end
62
-
63
- it { is_expected.to eq([]) }
64
- end
65
-
66
- context 'with element definition having nil as contents value' do
67
- let(:element_definition) do
68
- {
69
- 'name' => 'element',
70
- 'contents' => nil
71
- }
72
- end
73
-
74
- it "returns empty array" do
75
- is_expected.to eq([])
76
- end
77
- end
78
-
79
- context 'with content settings tinymce set to true only' do
80
- let(:element_definition) do
81
- {
82
- 'name' => 'element',
83
- 'contents' => [
84
- 'name' => 'headline',
85
- 'settings' => {
86
- 'tinymce' => true
87
- }
88
- ]
89
- }
90
- end
91
-
92
- it "returns empty array" do
93
- is_expected.to eq([])
94
- end
95
- end
96
-
97
- context 'with a page given' do
98
- let(:page) { mock_model('Page') }
99
- subject { Tinymce.custom_config_contents(page) }
100
-
101
- it "only returns custom tinymce config for elements of that page" do
102
- expect(page).to receive(:element_definitions).and_return([element_definition])
103
- is_expected.to include(
104
- {'element' => element_definition['name']
105
- }.merge(content_definition))
106
- end
107
- end
108
- end
109
- end
110
- end
111
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Alchemy::AuthAccessors' do
4
- describe '.user_class' do
5
- it "injects userstamp class methods" do
6
- expect(Alchemy.user_class).to respond_to(:stamper_class_name)
7
- expect(Alchemy.user_class.stamper_class_name).to eq(:DummyUser)
8
- end
9
- end
10
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- describe Messages do
5
- let(:message) { Message.new(email: 'jon@doe.com', message: 'Lorem ipsum') }
6
- let(:mail) { Messages.contact_form_mail(message, 'admin@page.com', 'contact@page.com', 'Subject') }
7
-
8
- it "delivers a mail to owner" do
9
- expect(mail.to).to eq(['admin@page.com'])
10
- expect(mail.subject).to eq('Subject')
11
- end
12
-
13
- it "reply_to should be set to senders email" do
14
- expect(mail.reply_to).to eq([message.email])
15
- end
16
-
17
- it "mail body includes message" do
18
- expect(mail.body).to match /#{message.message}/
19
- end
20
- end
21
- end
@@ -1,250 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- module Alchemy
5
- describe Attachment do
6
- let(:file) { File.new(File.expand_path('../../../fixtures/image with spaces.png', __FILE__)) }
7
- let(:attachment) { Attachment.new(file: file) }
8
-
9
- describe 'after assign' do
10
- it "stores the file mime type into database" do
11
- attachment.update(file: file)
12
- expect(attachment.file_mime_type).not_to be_blank
13
- end
14
- end
15
-
16
- describe 'after create' do
17
- before { attachment.save! }
18
-
19
- it "should have a humanized name" do
20
- expect(attachment.name).to eq("image with spaces")
21
- end
22
-
23
- after { attachment.destroy }
24
- end
25
-
26
- describe 'urlname sanitizing' do
27
- it "escapes unsafe url characters" do
28
- attachment.file_name = 'f#%&cking cute kitten pic.png'
29
- expect(attachment.urlname).to eq('f%23%25%26cking+cute+kitten+pic')
30
- end
31
-
32
- it "removes format suffix from end of file name" do
33
- attachment.file_name = 'pic.png.png'
34
- expect(attachment.urlname).to eq('pic+png')
35
- end
36
-
37
- it "converts dots into escaped spaces" do
38
- attachment.file_name = 'cute.kitten.pic.png'
39
- expect(attachment.urlname).to eq('cute+kitten+pic')
40
- end
41
-
42
- it "escapes umlauts in the name" do
43
- attachment.file_name = 'süßes katzenbild.png'
44
- expect(attachment.urlname).to eq('s%C3%BC%C3%9Fes+katzenbild')
45
- end
46
- end
47
-
48
- describe 'validations' do
49
- context "having a png, but only pdf allowed" do
50
- before do
51
- allow(Config).to receive(:get) do
52
- {'allowed_filetypes' => {'alchemy/attachments' => ['pdf']}}
53
- end
54
- end
55
-
56
- it "should not be valid" do
57
- expect(attachment).not_to be_valid
58
- end
59
- end
60
-
61
- context "having a png and everything allowed" do
62
- before do
63
- allow(Config).to receive(:get) do
64
- {'allowed_filetypes' => {'alchemy/attachments' => ['*']}}
65
- end
66
- end
67
-
68
- it "should be valid" do
69
- expect(attachment).to be_valid
70
- end
71
- end
72
-
73
- context "having a filename with special characters" do
74
- before do
75
- attachment.file_name = 'my FileNämü.pdf'
76
- attachment.save
77
- end
78
-
79
- it "should be valid" do
80
- expect(attachment).to be_valid
81
- end
82
- end
83
-
84
- context "having a filename with unallowed character" do
85
- before do
86
- attachment.file_name = 'my FileNämü?!.pdf'
87
- attachment.save
88
- end
89
-
90
- it "should not be valid" do
91
- expect(attachment).not_to be_valid
92
- end
93
- end
94
- end
95
-
96
- context 'PNG image' do
97
- subject { stub_model(Attachment, file_name: 'kitten.png') }
98
-
99
- describe '#extension' do
100
- subject { super().extension }
101
- it { is_expected.to eq("png") }
102
- end
103
- end
104
-
105
- describe 'css classes' do
106
- context 'mp3 file' do
107
- subject { stub_model(Attachment, file_mime_type: 'audio/mpeg') }
108
-
109
- describe '#icon_css_class' do
110
- subject { super().icon_css_class }
111
- it { is_expected.to eq("audio") }
112
- end
113
- end
114
-
115
- context 'video file' do
116
- subject { stub_model(Attachment, file_mime_type: 'video/mpeg') }
117
-
118
- describe '#icon_css_class' do
119
- subject { super().icon_css_class }
120
- it { is_expected.to eq("video") }
121
- end
122
- end
123
-
124
- context 'png file' do
125
- subject { stub_model(Attachment, file_mime_type: 'image/png') }
126
-
127
- describe '#icon_css_class' do
128
- subject { super().icon_css_class }
129
- it { is_expected.to eq("image") }
130
- end
131
- end
132
-
133
- context 'vcf file' do
134
- subject { stub_model(Attachment, file_mime_type: 'application/vcard') }
135
-
136
- describe '#icon_css_class' do
137
- subject { super().icon_css_class }
138
- it { is_expected.to eq("vcard") }
139
- end
140
- end
141
-
142
- context 'zip file' do
143
- subject { stub_model(Attachment, file_mime_type: 'application/zip') }
144
-
145
- describe '#icon_css_class' do
146
- subject { super().icon_css_class }
147
- it { is_expected.to eq("archive") }
148
- end
149
- end
150
-
151
- context 'flash file' do
152
- subject { stub_model(Attachment, file_mime_type: 'application/x-shockwave-flash') }
153
-
154
- describe '#icon_css_class' do
155
- subject { super().icon_css_class }
156
- it { is_expected.to eq("flash") }
157
- end
158
- end
159
-
160
- context 'photoshop file' do
161
- subject { stub_model(Attachment, file_mime_type: 'image/x-psd') }
162
-
163
- describe '#icon_css_class' do
164
- subject { super().icon_css_class }
165
- it { is_expected.to eq("psd") }
166
- end
167
- end
168
-
169
- context 'text file' do
170
- subject { stub_model(Attachment, file_mime_type: 'text/plain') }
171
-
172
- describe '#icon_css_class' do
173
- subject { super().icon_css_class }
174
- it { is_expected.to eq("text") }
175
- end
176
- end
177
-
178
- context 'rtf file' do
179
- subject { stub_model(Attachment, file_mime_type: 'application/rtf') }
180
-
181
- describe '#icon_css_class' do
182
- subject { super().icon_css_class }
183
- it { is_expected.to eq("rtf") }
184
- end
185
- end
186
-
187
- context 'pdf file' do
188
- subject { stub_model(Attachment, file_mime_type: 'application/pdf') }
189
-
190
- describe '#icon_css_class' do
191
- subject { super().icon_css_class }
192
- it { is_expected.to eq("pdf") }
193
- end
194
- end
195
-
196
- context 'word file' do
197
- subject { stub_model(Attachment, file_mime_type: 'application/msword') }
198
-
199
- describe '#icon_css_class' do
200
- subject { super().icon_css_class }
201
- it { is_expected.to eq("word") }
202
- end
203
- end
204
-
205
- context 'excel file' do
206
- subject { stub_model(Attachment, file_mime_type: 'application/vnd.ms-excel') }
207
-
208
- describe '#icon_css_class' do
209
- subject { super().icon_css_class }
210
- it { is_expected.to eq("excel") }
211
- end
212
- end
213
-
214
- context 'unknown file' do
215
- subject { stub_model(Attachment, file_mime_type: '') }
216
-
217
- describe '#icon_css_class' do
218
- subject { super().icon_css_class }
219
- it { is_expected.to eq("file") }
220
- end
221
- end
222
- end
223
-
224
- describe '#restricted?' do
225
- subject { attachment.restricted? }
226
-
227
- context 'if only on restricted pages' do
228
- before do
229
- pages = double(any?: true)
230
- expect(pages).to receive(:not_restricted).and_return([])
231
- expect(attachment).to receive(:pages).twice.and_return(pages)
232
- end
233
-
234
- it { is_expected.to be_truthy }
235
- end
236
-
237
- context 'if not only on restricted pages' do
238
- let(:page) { mock_model(Page) }
239
-
240
- before do
241
- pages = double(any?: true)
242
- expect(pages).to receive(:not_restricted).and_return([page])
243
- expect(attachment).to receive(:pages).twice.and_return(pages)
244
- end
245
-
246
- it { is_expected.to be_falsey }
247
- end
248
- end
249
- end
250
- end