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,78 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Picture url helpers" do
4
- describe "for cropped picture" do
5
- let(:path) do
6
- show_picture_path(id: 3, crop: "crop", size: "100x33", name: "kitten", format: "jpg")
7
- end
8
-
9
- it "should generate a url string" do
10
- expect(path).to eq("/pictures/3/show/100x33/crop/kitten.jpg")
11
- end
12
- end
13
-
14
- describe "for cropped and masked picture" do
15
- let(:path) do
16
- show_picture_path(
17
- id: 3,
18
- crop: "crop",
19
- crop_from: "0x0",
20
- crop_size: "900x300",
21
- size: "100x33",
22
- name: "kitten",
23
- format: :jpg
24
- )
25
- end
26
-
27
- it "should generate a url string" do
28
- expect(path).to eq("/pictures/3/show/100x33/crop/0x0/900x300/kitten.jpg")
29
- end
30
- end
31
-
32
- describe "for cropped thumbnail" do
33
- let(:path) do
34
- thumbnail_path(id: 3, crop: "crop", size: "100x33", name: "kitten", format: :jpg)
35
- end
36
-
37
- it "should generate a url string" do
38
- expect(path).to eq("/pictures/3/thumbnails/100x33/crop/kitten.jpg")
39
- end
40
- end
41
-
42
- describe "for thumbnail with default name and format" do
43
- let(:path) do
44
- thumbnail_path(id: 3, size: "100x33")
45
- end
46
-
47
- it "should generate a url string" do
48
- expect(path).to eq("/pictures/3/thumbnails/100x33/thumbnail.png")
49
- end
50
- end
51
-
52
- describe "for cropped and masked thumbnail" do
53
- let(:path) do
54
- thumbnail_path(
55
- id: 3,
56
- crop_from: "0x0",
57
- crop_size: "900x300",
58
- size: "100x33",
59
- name: "kitten",
60
- format: :jpg
61
- )
62
- end
63
-
64
- it "should generate a url string" do
65
- expect(path).to eq("/pictures/3/thumbnails/100x33/0x0/900x300/kitten.jpg")
66
- end
67
- end
68
-
69
- describe "for zoomed image" do
70
- let(:path) do
71
- zoom_picture_path(id: 3, name: "kitten", format: :jpg)
72
- end
73
-
74
- it "should generate a url string" do
75
- expect(path).to eq("/pictures/3/zoom/kitten.jpg")
76
- end
77
- end
78
- end
@@ -1,200 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Alchemy::ElementsHelper
4
-
5
- module Alchemy
6
- describe UrlHelper do
7
- let(:page) { mock_model(Page, urlname: 'testpage', language_code: 'en') }
8
-
9
- before do
10
- helper.controller.class_eval { include Alchemy::ConfigurationMethods }
11
- end
12
-
13
- context 'page path helpers' do
14
- describe "#show_page_path_params" do
15
- subject(:show_page_path_params) { helper.show_page_path_params(page) }
16
-
17
- context "if prefix_locale? is false" do
18
- before do
19
- expect(helper).to receive(:prefix_locale?) { false }
20
- end
21
-
22
- it "returns a Hash with urlname and no locale parameter" do
23
- expect(show_page_path_params).to include(urlname: 'testpage')
24
- expect(show_page_path_params).to_not include(locale: 'en')
25
- end
26
-
27
- context "with addiitonal parameters" do
28
- subject(:show_page_path_params) do
29
- helper.show_page_path_params(page, {query: 'test'})
30
- end
31
-
32
- it "returns a Hash with urlname, no locale and query parameter" do
33
- expect(show_page_path_params).to \
34
- include(urlname: 'testpage', query: 'test')
35
- expect(show_page_path_params).to_not \
36
- include(locale: 'en')
37
- end
38
- end
39
- end
40
-
41
- context "if prefix_locale? is false" do
42
- before do
43
- expect(helper).to receive(:prefix_locale?) { true }
44
- end
45
-
46
- it "returns a Hash with urlname and locale parameter" do
47
- expect(show_page_path_params).to \
48
- include(urlname: 'testpage', locale: 'en')
49
- end
50
-
51
- context "with additional parameters" do
52
- subject(:show_page_path_params) do
53
- helper.show_page_path_params(page, {query: 'test'})
54
- end
55
-
56
- it "returns a Hash with urlname, locale and query parameter" do
57
- expect(show_page_path_params).to \
58
- include(urlname: 'testpage', locale: 'en', query: 'test')
59
- end
60
- end
61
- end
62
- end
63
-
64
- describe "#show_alchemy_page_path" do
65
- context "when prefix_locale? set to true" do
66
- before do
67
- expect(helper).to receive(:prefix_locale?) { true }
68
- end
69
-
70
- it "should return the correct relative path string" do
71
- expect(helper.show_alchemy_page_path(page)).to eq("/#{page.language_code}/testpage")
72
- end
73
-
74
- it "should return the correct relative path string with additional parameters" do
75
- expect(helper.show_alchemy_page_path(page, {query: 'test'})).to \
76
- eq("/#{page.language_code}/testpage?query=test")
77
- end
78
- end
79
-
80
- context "when prefix_locale? set to false" do
81
- before do
82
- expect(helper).to receive(:prefix_locale?) { false }
83
- end
84
-
85
- it "should return the correct relative path string" do
86
- expect(helper.show_alchemy_page_path(page)).to eq("/testpage")
87
- end
88
-
89
- it "should return the correct relative path string with additional parameter" do
90
- expect(helper.show_alchemy_page_path(page, {query: 'test'})).to \
91
- eq("/testpage?query=test")
92
- end
93
- end
94
- end
95
-
96
- describe "#show_alchemy_page_url" do
97
- context "when prefix_locale? set to true" do
98
- before do
99
- expect(helper).to receive(:prefix_locale?) { true }
100
- end
101
-
102
- it "should return the correct url string" do
103
- expect(helper.show_alchemy_page_url(page)).to \
104
- eq("http://#{helper.request.host}/#{page.language_code}/testpage")
105
- end
106
-
107
- it "should return the correct url string with additional parameters" do
108
- expect(helper.show_alchemy_page_url(page, {query: 'test'})).to \
109
- eq("http://#{helper.request.host}/#{page.language_code}/testpage?query=test")
110
- end
111
- end
112
-
113
- context "when prefix_locale? set to false" do
114
- before do
115
- expect(helper).to receive(:prefix_locale?) { false }
116
- end
117
-
118
- it "should return the correct url string" do
119
- expect(helper.show_alchemy_page_url(page)).to \
120
- eq("http://#{helper.request.host}/testpage")
121
- end
122
-
123
- it "should return the correct url string with additional parameter" do
124
- expect(helper.show_alchemy_page_url(page, {query: 'test'})).to \
125
- eq("http://#{helper.request.host}/testpage?query=test")
126
- end
127
- end
128
- end
129
- end
130
-
131
- context 'picture path helpers' do
132
- let(:picture) { stub_model(Picture, urlname: 'cute_kitten', id: 42) }
133
-
134
- describe '#show_alchemy_picture_path' do
135
- it "should return the correct relative path string" do
136
- expect(helper.show_alchemy_picture_path(picture)).to \
137
- match(Regexp.new("/pictures/42/show/cute_kitten.jpg"))
138
- end
139
- end
140
-
141
- describe '#show_alchemy_picture_url' do
142
- it "should return the correct url string" do
143
- expect(helper.show_alchemy_picture_url(picture)).to \
144
- match(Regexp.new("http://#{helper.request.host}/pictures/42/show/cute_kitten.jpg"))
145
- end
146
- end
147
-
148
- describe '#show_picture_path_params' do
149
- it "should return the correct params for rendering a picture" do
150
- expect(helper.show_picture_path_params(picture)).to \
151
- include(name: 'cute_kitten', format: 'jpg')
152
- end
153
-
154
- it "should include the secure hash parameter" do
155
- expect(helper.show_picture_path_params(picture).keys).to include(:sh)
156
- expect(helper.show_picture_path_params(picture)[:sh]).not_to be_empty
157
- end
158
-
159
- context "with additional params" do
160
- it "should include these params" do
161
- expect(helper.show_picture_path_params(picture, {format: 'png'})).to \
162
- include(name: 'cute_kitten', format: 'png')
163
- end
164
- end
165
-
166
- context "with additional params crop set to true" do
167
- it "should include crop as parameter" do
168
- expect(helper.show_picture_path_params(picture, {crop: true})).to \
169
- include(name: 'cute_kitten', crop: 'crop')
170
- end
171
- end
172
- end
173
- end
174
-
175
- context 'attachment path helpers' do
176
- let(:attachment) { mock_model(Attachment, urlname: 'test-attachment.pdf') }
177
-
178
- it 'should return the correct relative path to download an attachment' do
179
- expect(helper.download_alchemy_attachment_path(attachment)).to \
180
- eq("/attachment/#{attachment.id}/download/#{attachment.urlname}")
181
- end
182
-
183
- it 'should return the correct url to download an attachment' do
184
- expect(helper.download_alchemy_attachment_url(attachment)).to \
185
- eq("http://#{helper.request.host}/attachment/#{attachment.id}/download/#{attachment.urlname}")
186
- end
187
- end
188
-
189
- describe '#full_url_for_element' do
190
- subject { full_url_for_element(element) }
191
-
192
- let(:element) { build_stubbed(:alchemy_element, name: 'headline', page: page) }
193
- let(:current_server) { '' }
194
-
195
- it "returns the url to this element" do
196
- is_expected.to eq("#{current_server}/#{element.page.urlname}##{element_dom_id(element)}")
197
- end
198
- end
199
- end
200
- end
@@ -1,82 +0,0 @@
1
- #= require jasmine-jquery
2
-
3
- describe "Alchemy.Dialog", ->
4
-
5
- # beforeEach ->
6
- # # first load the jasmine-jquery fixtures
7
- # # loadFixtures('fixture.html')
8
- # # then use ajax mocking
9
- # jasmine.Ajax.useMock()
10
-
11
- afterEach ->
12
- @dialog.dialog.remove()
13
- if @dialog.overlay
14
- @dialog.overlay.remove()
15
-
16
- describe 'with default options', ->
17
- beforeEach ->
18
- @dialog = new Alchemy.Dialog('/events/new')
19
-
20
- it 'appends the dialog to the dom', ->
21
- expect($('.alchemy-dialog')).toHaveLength(1)
22
-
23
- it 'appends an overlay to the dom', ->
24
- expect($('.alchemy-dialog-overlay')).toHaveLength(1)
25
-
26
- it 'has a close button', ->
27
- expect($('.alchemy-dialog-close')).toHaveLength(1)
28
-
29
- it 'has a title bar', ->
30
- expect($('.alchemy-dialog-title')).toHaveLength(1)
31
-
32
- it 'has a body', ->
33
- expect($('.alchemy-dialog-body')).toHaveLength(1)
34
-
35
- it 'has width and height attributes', ->
36
- expect(@dialog.width).toEqual(400)
37
- expect(@dialog.height).toEqual(300)
38
-
39
- it 'has max-width and min-height styles', ->
40
- expect(@dialog.dialog).toHaveCss({'max-width': '400px', 'min-height': '300px'})
41
-
42
- describe '#open', ->
43
- beforeEach ->
44
- @dialog.open()
45
-
46
- it 'adds "open" class to the dialog', ->
47
- expect(@dialog.dialog).toHaveClass('open')
48
-
49
- it 'adds "open" class to the overlay', ->
50
- expect(@dialog.overlay).toHaveClass('open')
51
-
52
- it 'attaches "#close" click event to close button', ->
53
- expect(@dialog.close_button).toHandleWith('click', @dialog.close)
54
-
55
- it 'attaches "#close" click event to overlay', ->
56
- expect(@dialog.overlay).toHandleWith('click', @dialog.close)
57
-
58
- it 'attaches "#close" key event to esc key', ->
59
- expect(@dialog.$document).toHandle('keydown')
60
-
61
- describe '#load', ->
62
- beforeEach ->
63
- @dialog.load()
64
-
65
- it 'shows a spinner', ->
66
- expect(@dialog.dialog_body.find('.spinner')).toHaveLength(1)
67
-
68
- xit 'loads content via ajax'
69
-
70
- describe 'with modal set to false', ->
71
- beforeEach ->
72
- @dialog = new Alchemy.Dialog('/events/new', {modal: false})
73
-
74
- it 'does not append the overlay to the dom', ->
75
- expect($('.alchemy-dialog-overlay').length).toEqual(0)
76
-
77
- describe 'with title given', ->
78
- beforeEach ->
79
- @dialog = new Alchemy.Dialog('/events/new', {title: 'My Title'})
80
-
81
- it 'has a title', ->
82
- expect($('.alchemy-dialog-title')).toContainText('My Title')
@@ -1,25 +0,0 @@
1
- #= require jasmine-jquery
2
-
3
- describe "Alchemy.LinkOverlay", ->
4
-
5
- beforeEach ->
6
- setFixtures('<div id="myelement"></div>')
7
-
8
- it "should be on object", ->
9
- expect(Alchemy.LinkOverlay).toBeDefined()
10
- describe "close", ->
11
- xit "should ....", ->
12
- describe "selectPage", ->
13
- xit "should ....", ->
14
- describe "createLink", ->
15
- xit "should ....", ->
16
- describe "selectTab", ->
17
- xit "should ....", ->
18
- describe "showElementsSelect", ->
19
- xit "should ....", ->
20
- describe "hideElementsSelect", ->
21
- xit "should ....", ->
22
- describe "createTempLink", ->
23
- xit "should ....", ->
24
- describe "removeLink", ->
25
- xit "should ....", ->
@@ -1,3 +0,0 @@
1
- describe 'Alchemy', ->
2
- it 'should provide an Alchemy Javascript Object', ->
3
- expect(Alchemy).toBeDefined()
@@ -1,3 +0,0 @@
1
- <select id="selectfield1">
2
-
3
- </select>
@@ -1,199 +0,0 @@
1
- /*
2
- Jasmine-Ajax : a set of helpers for testing AJAX requests under the Jasmine
3
- BDD framework for JavaScript.
4
-
5
- Supports jQuery.
6
-
7
- http://github.com/pivotal/jasmine-ajax
8
-
9
- Jasmine Home page: http://pivotal.github.com/jasmine
10
-
11
- Copyright (c) 2008-2013 Pivotal Labs
12
-
13
- Permission is hereby granted, free of charge, to any person obtaining
14
- a copy of this software and associated documentation files (the
15
- "Software"), to deal in the Software without restriction, including
16
- without limitation the rights to use, copy, modify, merge, publish,
17
- distribute, sublicense, and/or sell copies of the Software, and to
18
- permit persons to whom the Software is furnished to do so, subject to
19
- the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be
22
- included in all copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
-
32
- */
33
-
34
- // Jasmine-Ajax interface
35
- var ajaxRequests = [];
36
-
37
- function mostRecentAjaxRequest() {
38
- if (ajaxRequests.length > 0) {
39
- return ajaxRequests[ajaxRequests.length - 1];
40
- } else {
41
- return null;
42
- }
43
- }
44
-
45
- function clearAjaxRequests() {
46
- ajaxRequests = [];
47
- }
48
-
49
- // Fake XHR for mocking Ajax Requests & Responses
50
- function FakeXMLHttpRequest() {
51
- var extend = Object.extend || jQuery.extend;
52
- extend(this, {
53
- requestHeaders: {},
54
-
55
- open: function() {
56
- this.method = arguments[0];
57
- this.url = arguments[1];
58
- this.username = arguments[3];
59
- this.password = arguments[4];
60
- this.readyState = 1;
61
- },
62
-
63
- setRequestHeader: function(header, value) {
64
- this.requestHeaders[header] = value;
65
- },
66
-
67
- abort: function() {
68
- this.readyState = 0;
69
- },
70
-
71
- readyState: 0,
72
-
73
- onload: function() {
74
- },
75
-
76
- onreadystatechange: function(isTimeout) {
77
- },
78
-
79
- status: null,
80
-
81
- send: function(data) {
82
- this.params = data;
83
- this.readyState = 2;
84
- },
85
-
86
- data: function() {
87
- var data = {};
88
- if (typeof this.params !== 'string') return data;
89
- var params = this.params.split('&');
90
-
91
- for (var i = 0; i < params.length; ++i) {
92
- var kv = params[i].replace(/\+/g, ' ').split('=');
93
- var key = decodeURIComponent(kv[0]);
94
- data[key] = data[key] || [];
95
- data[key].push(decodeURIComponent(kv[1]));
96
- data[key].sort();
97
- }
98
- return data;
99
- },
100
-
101
- getResponseHeader: function(name) {
102
- return this.responseHeaders[name];
103
- },
104
-
105
- getAllResponseHeaders: function() {
106
- var responseHeaders = [];
107
- for (var i in this.responseHeaders) {
108
- if (this.responseHeaders.hasOwnProperty(i)) {
109
- responseHeaders.push(i + ': ' + this.responseHeaders[i]);
110
- }
111
- }
112
- return responseHeaders.join('\r\n');
113
- },
114
-
115
- responseText: null,
116
-
117
- response: function(response) {
118
- this.status = response.status;
119
- this.responseText = response.responseText || "";
120
- this.readyState = 4;
121
- this.responseHeaders = response.responseHeaders ||
122
- {"Content-type": response.contentType || "application/json" };
123
- // uncomment for jquery 1.3.x support
124
- // jasmine.Clock.tick(20);
125
-
126
- this.onload();
127
- this.onreadystatechange();
128
- },
129
- responseTimeout: function() {
130
- this.readyState = 4;
131
- jasmine.Clock.tick(jQuery.ajaxSettings.timeout || 30000);
132
- this.onreadystatechange('timeout');
133
- }
134
- });
135
-
136
- return this;
137
- }
138
-
139
-
140
- jasmine.Ajax = {
141
-
142
- isInstalled: function() {
143
- return jasmine.Ajax.installed === true;
144
- },
145
-
146
- assertInstalled: function() {
147
- if (!jasmine.Ajax.isInstalled()) {
148
- throw new Error("Mock ajax is not installed, use jasmine.Ajax.useMock()");
149
- }
150
- },
151
-
152
- useMock: function() {
153
- if (!jasmine.Ajax.isInstalled()) {
154
- var spec = jasmine.getEnv().currentSpec;
155
- spec.after(jasmine.Ajax.uninstallMock);
156
-
157
- jasmine.Ajax.installMock();
158
- }
159
- },
160
-
161
- installMock: function() {
162
- if (typeof jQuery != 'undefined') {
163
- jasmine.Ajax.installJquery();
164
- } else {
165
- throw new Error("jasmine.Ajax currently only supports jQuery");
166
- }
167
- jasmine.Ajax.installed = true;
168
- },
169
-
170
- installJquery: function() {
171
- jasmine.Ajax.mode = 'jQuery';
172
- jasmine.Ajax.real = jQuery.ajaxSettings.xhr;
173
- jQuery.ajaxSettings.xhr = jasmine.Ajax.jQueryMock;
174
-
175
- },
176
-
177
- uninstallMock: function() {
178
- jasmine.Ajax.assertInstalled();
179
- if (jasmine.Ajax.mode == 'jQuery') {
180
- jQuery.ajaxSettings.xhr = jasmine.Ajax.real;
181
- }
182
- jasmine.Ajax.reset();
183
- },
184
-
185
- reset: function() {
186
- jasmine.Ajax.installed = false;
187
- jasmine.Ajax.mode = null;
188
- jasmine.Ajax.real = null;
189
- },
190
-
191
- jQueryMock: function() {
192
- var newXhr = new FakeXMLHttpRequest();
193
- ajaxRequests.push(newXhr);
194
- return newXhr;
195
- },
196
-
197
- installed: false,
198
- mode: null
199
- };