alchemy_cms 3.0.4 → 3.1.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -6
  3. data/Gemfile +4 -7
  4. data/README.md +207 -115
  5. data/alchemy_cms.gemspec +10 -9
  6. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +2 -2
  7. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +2 -2
  8. data/app/assets/javascripts/alchemy/alchemy.js +6 -7
  9. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +1 -43
  10. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +1 -1
  11. data/app/assets/stylesheets/alchemy/_mixins.scss +2 -1
  12. data/app/assets/stylesheets/alchemy/buttons.scss +0 -5
  13. data/app/assets/stylesheets/alchemy/dialogs.scss +1 -0
  14. data/app/assets/stylesheets/alchemy/frame.scss +9 -12
  15. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +11 -2
  16. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +9 -1
  17. data/app/controllers/alchemy/admin/attachments_controller.rb +2 -4
  18. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +34 -38
  19. data/app/controllers/alchemy/api/base_controller.rb +19 -0
  20. data/app/controllers/alchemy/api/contents_controller.rb +35 -0
  21. data/app/controllers/alchemy/api/elements_controller.rb +29 -0
  22. data/app/controllers/alchemy/api/pages_controller.rb +32 -0
  23. data/app/controllers/alchemy/contents_controller.rb +1 -0
  24. data/app/controllers/alchemy/elements_controller.rb +5 -2
  25. data/app/controllers/alchemy/pages_controller.rb +4 -1
  26. data/app/controllers/alchemy/pictures_controller.rb +4 -36
  27. data/app/helpers/alchemy/admin/essences_helper.rb +5 -2
  28. data/app/helpers/alchemy/essences_helper.rb +14 -1
  29. data/app/models/alchemy/content.rb +32 -4
  30. data/app/models/alchemy/element.rb +2 -16
  31. data/app/models/alchemy/element/presenters.rb +2 -2
  32. data/app/models/alchemy/essence_file.rb +5 -0
  33. data/app/models/alchemy/essence_picture.rb +12 -8
  34. data/app/models/alchemy/picture.rb +1 -74
  35. data/app/models/alchemy/picture/transformations.rb +249 -0
  36. data/app/serializers/alchemy/content_serializer.rb +3 -10
  37. data/app/serializers/alchemy/element_serializer.rb +6 -3
  38. data/app/serializers/alchemy/legacy_element_serializer.rb +17 -0
  39. data/app/views/alchemy/admin/dashboard/_sites.html.erb +14 -4
  40. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +8 -5
  41. data/app/views/alchemy/admin/pages/edit.html.erb +9 -9
  42. data/app/views/alchemy/admin/pictures/info.html.erb +2 -3
  43. data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
  44. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +8 -7
  45. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +3 -3
  46. data/app/views/alchemy/essences/_essence_date_editor.html.erb +8 -2
  47. data/app/views/alchemy/essences/_essence_date_view.html.erb +10 -8
  48. data/app/views/alchemy/essences/_essence_file_editor.html.erb +48 -53
  49. data/app/views/alchemy/essences/_essence_file_view.html.erb +5 -5
  50. data/app/views/alchemy/essences/_essence_html_editor.html.erb +5 -4
  51. data/app/views/alchemy/essences/_essence_link_editor.html.erb +17 -15
  52. data/app/views/alchemy/essences/_essence_link_view.html.erb +11 -7
  53. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +4 -2
  54. data/app/views/alchemy/essences/_essence_picture_view.html.erb +4 -2
  55. data/app/views/alchemy/essences/_essence_richtext_view.html.erb +5 -4
  56. data/app/views/alchemy/essences/_essence_select_editor.html.erb +22 -32
  57. data/app/views/alchemy/essences/_essence_text_view.html.erb +7 -6
  58. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
  59. data/app/views/layouts/alchemy/admin.html.erb +5 -3
  60. data/config/initializers/inflections.rb +3 -0
  61. data/config/initializers/simple_form.rb +1 -1
  62. data/config/locales/alchemy.en.yml +0 -1
  63. data/config/routes.rb +14 -0
  64. data/lib/alchemy/capistrano.rb +71 -0
  65. data/lib/alchemy/engine.rb +0 -3
  66. data/lib/alchemy/essence.rb +1 -1
  67. data/lib/alchemy/permissions.rb +19 -5
  68. data/lib/alchemy/picture_attributes.rb +1 -1
  69. data/lib/alchemy/test_support/auth_helpers.rb +1 -1
  70. data/lib/alchemy/test_support/essence_shared_examples.rb +37 -22
  71. data/lib/alchemy/test_support/integration_helpers.rb +1 -1
  72. data/lib/alchemy/tinymce.rb +21 -4
  73. data/lib/alchemy/upgrader/three_point_one.rb +43 -0
  74. data/lib/alchemy/upgrader/three_point_zero.rb +13 -0
  75. data/lib/alchemy/version.rb +2 -1
  76. data/lib/rails/generators/alchemy/module/module_generator.rb +30 -0
  77. data/lib/rails/generators/alchemy/module/templates/ability.rb.tt +11 -0
  78. data/lib/rails/generators/alchemy/module/templates/controller.rb.tt +2 -0
  79. data/lib/rails/generators/alchemy/module/templates/module_config.rb.tt +15 -0
  80. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +0 -1
  81. data/lib/rails/templates/alchemy.rb +2 -2
  82. data/lib/tasks/alchemy/db.rake +7 -1
  83. data/spec/controllers/admin/attachments_controller_spec.rb +38 -38
  84. data/spec/controllers/admin/base_controller_spec.rb +18 -18
  85. data/spec/controllers/admin/clipboard_controller_spec.rb +23 -18
  86. data/spec/controllers/admin/contents_controller_spec.rb +33 -27
  87. data/spec/controllers/admin/dashboard_controller_spec.rb +14 -14
  88. data/spec/controllers/admin/elements_controller_spec.rb +125 -105
  89. data/spec/controllers/admin/essence_files_controller_spec.rb +6 -7
  90. data/spec/controllers/admin/essence_pictures_controller_spec.rb +52 -42
  91. data/spec/controllers/admin/languages_controller_spec.rb +3 -3
  92. data/spec/controllers/admin/pages_controller_spec.rb +81 -71
  93. data/spec/controllers/admin/pictures_controller_spec.rb +69 -72
  94. data/spec/controllers/admin/resources_controller_spec.rb +5 -5
  95. data/spec/controllers/admin/trash_controller_spec.rb +15 -12
  96. data/spec/controllers/alchemy/admin/tags_controller_spec.rb +8 -8
  97. data/spec/controllers/alchemy/api/contents_controller_spec.rb +73 -0
  98. data/spec/controllers/alchemy/api/elements_controller_spec.rb +69 -0
  99. data/spec/controllers/alchemy/api/pages_controller_spec.rb +86 -0
  100. data/spec/controllers/attachments_controller_spec.rb +8 -8
  101. data/spec/controllers/contents_controller_spec.rb +22 -0
  102. data/spec/controllers/elements_controller_spec.rb +10 -4
  103. data/spec/controllers/messages_controller_spec.rb +35 -34
  104. data/spec/controllers/pages_controller_spec.rb +37 -28
  105. data/spec/controllers/pictures_controller_spec.rb +90 -23
  106. data/spec/dummy/app/models/dummy_user.rb +0 -4
  107. data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +11 -0
  108. data/spec/dummy/config/alchemy/elements.yml +22 -1
  109. data/spec/dummy/config/alchemy/page_layouts.yml +4 -0
  110. data/spec/dummy/config/application.rb +2 -1
  111. data/spec/dummy/config/environments/test.rb +3 -1
  112. data/spec/features/admin/dashboard_spec.rb +41 -6
  113. data/spec/features/admin/language_tree_feature_spec.rb +3 -3
  114. data/spec/features/admin/legacy_page_url_management_spec.rb +1 -1
  115. data/spec/features/admin/link_overlay_spec.rb +7 -7
  116. data/spec/features/admin/locale_select_feature_spec.rb +5 -2
  117. data/spec/features/admin/modules_integration_spec.rb +1 -1
  118. data/spec/features/admin/page_creation_feature_spec.rb +3 -2
  119. data/spec/features/admin/page_editing_feature_spec.rb +66 -79
  120. data/spec/features/admin/picture_library_integration_spec.rb +8 -8
  121. data/spec/features/admin/resources_integration_spec.rb +21 -21
  122. data/spec/features/admin/tinymce_feature_spec.rb +36 -0
  123. data/spec/features/navigation_spec.rb +1 -1
  124. data/spec/features/page_feature_spec.rb +34 -34
  125. data/spec/features/picture_security_spec.rb +4 -4
  126. data/spec/features/security_spec.rb +1 -1
  127. data/spec/features/translation_integration_spec.rb +7 -7
  128. data/spec/helpers/admin/base_helper_spec.rb +51 -49
  129. data/spec/helpers/admin/contents_helper_spec.rb +11 -11
  130. data/spec/helpers/admin/elements_helper_spec.rb +20 -17
  131. data/spec/helpers/admin/essences_helper_spec.rb +42 -11
  132. data/spec/helpers/admin/navigation_helper_spec.rb +64 -54
  133. data/spec/helpers/admin/pages_helper_spec.rb +10 -10
  134. data/spec/helpers/admin/tags_helper_spec.rb +16 -16
  135. data/spec/helpers/base_helper_spec.rb +11 -11
  136. data/spec/helpers/elements_block_helper_spec.rb +24 -24
  137. data/spec/helpers/elements_helper_spec.rb +46 -46
  138. data/spec/helpers/essences_helper_spec.rb +90 -17
  139. data/spec/helpers/pages_helper_spec.rb +53 -53
  140. data/spec/helpers/picture_url_helpers_spec.rb +6 -6
  141. data/spec/helpers/url_helper_spec.rb +32 -32
  142. data/spec/libraries/config_spec.rb +9 -9
  143. data/spec/libraries/controller_actions_spec.rb +14 -14
  144. data/spec/libraries/i18n_spec.rb +6 -6
  145. data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +4 -4
  146. data/spec/libraries/modules_spec.rb +4 -4
  147. data/spec/libraries/mount_point_spec.rb +13 -13
  148. data/spec/libraries/page_layout_spec.rb +24 -24
  149. data/spec/libraries/permissions_spec.rb +97 -80
  150. data/spec/libraries/resource_spec.rb +37 -37
  151. data/spec/libraries/resources_helper_spec.rb +19 -19
  152. data/spec/libraries/shell_spec.rb +17 -17
  153. data/spec/libraries/template_tracker_spec.rb +14 -14
  154. data/spec/libraries/tinymce_spec.rb +8 -8
  155. data/spec/libraries/userstamp_spec.rb +2 -2
  156. data/spec/mailers/messages_spec.rb +4 -4
  157. data/spec/models/attachment_spec.rb +86 -30
  158. data/spec/models/cell_spec.rb +10 -10
  159. data/spec/models/content_spec.rb +106 -46
  160. data/spec/models/element_spec.rb +94 -115
  161. data/spec/models/essence_date_spec.rb +1 -1
  162. data/spec/models/essence_file_spec.rb +4 -4
  163. data/spec/models/essence_picture_spec.rb +56 -25
  164. data/spec/models/essence_richtext_spec.rb +1 -1
  165. data/spec/models/essence_text_spec.rb +7 -7
  166. data/spec/models/language_spec.rb +12 -12
  167. data/spec/models/legacy_page_url_spec.rb +2 -2
  168. data/spec/models/message_spec.rb +12 -5
  169. data/spec/models/page_spec.rb +259 -235
  170. data/spec/models/picture_spec.rb +72 -166
  171. data/spec/models/site_spec.rb +41 -41
  172. data/spec/models/tag_spec.rb +7 -7
  173. data/spec/routing/api_routing_spec.rb +150 -0
  174. data/spec/routing/routing_spec.rb +28 -28
  175. data/spec/spec_helper.rb +6 -5
  176. data/spec/support/hint_examples.rb +5 -5
  177. data/spec/support/transformation_examples.rb +173 -0
  178. data/spec/tasks/helpers_spec.rb +29 -29
  179. data/spec/views/essences/essence_boolean_editor_spec.rb +32 -0
  180. data/spec/views/essences/essence_boolean_view_spec.rb +2 -2
  181. data/spec/views/essences/essence_date_view_spec.rb +1 -1
  182. data/spec/views/essences/essence_link_view_spec.rb +11 -0
  183. data/spec/views/essences/essence_picture_view_spec.rb +56 -11
  184. data/spec/views/essences/essence_richtext_view_spec.rb +12 -0
  185. data/spec/views/essences/essence_text_view_spec.rb +12 -0
  186. data/vendor/assets/javascripts/tinymce/langs/de.js +20 -2
  187. data/vendor/assets/javascripts/tinymce/langs/fr.js +14 -1
  188. data/vendor/assets/javascripts/tinymce/langs/nl.js +22 -4
  189. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -1
  190. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +1 -1
  191. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +1 -1
  192. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +1 -1
  193. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +1 -1
  194. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  195. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -1
  196. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +1 -1
  197. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +1 -1
  198. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +1 -1
  199. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +1 -1
  200. data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +1 -1
  201. data/vendor/assets/javascripts/tinymce/tinymce.min.js +11 -10
  202. metadata +72 -42
  203. data/app/views/alchemy/messages/contact_form_mail.es.text.erb +0 -12
  204. data/config/locales/alchemy.es.yml +0 -958
  205. data/config/locales/alchemy.ru.yml +0 -837
  206. data/config/locales/simple_form.es.yml +0 -6
  207. data/config/locales/simple_form.ru.yml +0 -25
  208. data/lib/rails/generators/alchemy/scaffold/files/alchemy.es.yml +0 -31
  209. data/vendor/assets/javascripts/tinymce/langs/es.js +0 -197
  210. data/vendor/assets/javascripts/tinymce/langs/ru.js +0 -197
@@ -21,8 +21,8 @@ module Alchemy
21
21
  end
22
22
 
23
23
  before do
24
- File.stub(exists?: true)
25
- YAML.stub(load_file: config)
24
+ allow(File).to receive(:exists?).and_return( true)
25
+ allow(YAML).to receive(:load_file).and_return(config)
26
26
  end
27
27
 
28
28
  describe "#database_dump_command" do
@@ -31,7 +31,7 @@ module Alchemy
31
31
  context "when config for RAILS_ENV not found" do
32
32
  let(:adapter) { 'mysql2' }
33
33
 
34
- before { Foo.stub(environment: 'huh?') }
34
+ before { allow(Foo).to receive(:environment).and_return('huh?') }
35
35
 
36
36
  it "should raise an error" do
37
37
  expect { subject }.to raise_error(RuntimeError)
@@ -50,27 +50,27 @@ module Alchemy
50
50
  let(:adapter) { 'mysql2' }
51
51
 
52
52
  it "uses the mysqldump command" do
53
- should include('mysqldump ')
53
+ is_expected.to include('mysqldump ')
54
54
  end
55
55
 
56
56
  context "when a username is set in the config file" do
57
- it { should include("--user='testuser'") }
57
+ it { is_expected.to include("--user='testuser'") }
58
58
  end
59
59
 
60
60
  context "when a password is set in the config file" do
61
- it { should include("--password='123456'") }
61
+ it { is_expected.to include("--password='123456'") }
62
62
  end
63
63
 
64
64
  context "when a host is set in the config file" do
65
65
  context "and the host is localhost" do
66
- it { should_not include("--host=") }
66
+ it { is_expected.not_to include("--host=") }
67
67
  end
68
68
 
69
69
  context "and the host is anything but not localhost" do
70
70
  before do
71
- YAML.stub(load_file: {'test' => {'host' => 'mydomain.com'}})
71
+ allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
72
72
  end
73
- it { should include("--host='mydomain.com'") }
73
+ it { is_expected.to include("--host='mydomain.com'") }
74
74
  end
75
75
  end
76
76
  end
@@ -79,27 +79,27 @@ module Alchemy
79
79
  let(:adapter) { 'postgresql' }
80
80
 
81
81
  it "uses the pg_dump command with clean option" do
82
- should include('pg_dump --clean')
82
+ is_expected.to include('pg_dump --clean')
83
83
  end
84
84
 
85
85
  context "when a username is set in the config file" do
86
- it { should include("--username='testuser'") }
86
+ it { is_expected.to include("--username='testuser'") }
87
87
  end
88
88
 
89
89
  context "when a password is set in the config file" do
90
- it { should include("PGPASSWORD='123456'") }
90
+ it { is_expected.to include("PGPASSWORD='123456'") }
91
91
  end
92
92
 
93
93
  context "when a host is set in the config file" do
94
94
  context "and the host is localhost" do
95
- it { should_not include("--host=") }
95
+ it { is_expected.not_to include("--host=") }
96
96
  end
97
97
 
98
98
  context "and the host is anything but not localhost" do
99
99
  before do
100
- YAML.stub(load_file: {'test' => {'host' => 'mydomain.com'}})
100
+ allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
101
101
  end
102
- it { should include("--host='mydomain.com'") }
102
+ it { is_expected.to include("--host='mydomain.com'") }
103
103
  end
104
104
  end
105
105
  end
@@ -115,7 +115,7 @@ module Alchemy
115
115
  context "when config for RAILS_ENV not found" do
116
116
  let(:adapter) { 'mysql' }
117
117
 
118
- before { Foo.stub(environment: 'huh?') }
118
+ before { allow(Foo).to receive(:environment).and_return('huh?') }
119
119
 
120
120
  it "should raise an error" do
121
121
  expect { subject }.to raise_error(RuntimeError)
@@ -134,27 +134,27 @@ module Alchemy
134
134
  let(:adapter) { 'mysql' }
135
135
 
136
136
  it "uses the mysql command" do
137
- should include('mysql ')
137
+ is_expected.to include('mysql ')
138
138
  end
139
139
 
140
140
  context "when a username is set in the config file" do
141
- it { should include("--user='testuser'") }
141
+ it { is_expected.to include("--user='testuser'") }
142
142
  end
143
143
 
144
144
  context "when a password is set in the config file" do
145
- it { should include("--password='123456'") }
145
+ it { is_expected.to include("--password='123456'") }
146
146
  end
147
147
 
148
148
  context "when a host is set in the config file" do
149
149
  context "and the host is localhost" do
150
- it { should_not include("--host=") }
150
+ it { is_expected.not_to include("--host=") }
151
151
  end
152
152
 
153
153
  context "and the host is anything but not localhost" do
154
154
  before do
155
- YAML.stub(load_file: {'test' => {'host' => 'mydomain.com'}})
155
+ allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
156
156
  end
157
- it { should include("--host='mydomain.com'") }
157
+ it { is_expected.to include("--host='mydomain.com'") }
158
158
  end
159
159
  end
160
160
  end
@@ -163,27 +163,27 @@ module Alchemy
163
163
  let(:adapter) { 'postgresql' }
164
164
 
165
165
  it "uses the psql command" do
166
- should include('psql ')
166
+ is_expected.to include('psql ')
167
167
  end
168
168
 
169
169
  context "when a username is set in the config file" do
170
- it { should include("--username='testuser'") }
170
+ it { is_expected.to include("--username='testuser'") }
171
171
  end
172
172
 
173
173
  context "when a password is set in the config file" do
174
- it { should include("PGPASSWORD='123456'") }
174
+ it { is_expected.to include("PGPASSWORD='123456'") }
175
175
  end
176
176
 
177
177
  context "when a host is set in the config file" do
178
178
  context "and the host is localhost" do
179
- it { should_not include("--host=") }
179
+ it { is_expected.not_to include("--host=") }
180
180
  end
181
181
 
182
182
  context "and the host is anything but not localhost" do
183
183
  before do
184
- YAML.stub(load_file: {'test' => {'host' => 'mydomain.com'}})
184
+ allow(YAML).to receive(:load_file).and_return({'test' => {'host' => 'mydomain.com'}})
185
185
  end
186
- it { should include("--host='mydomain.com'") }
186
+ it { is_expected.to include("--host='mydomain.com'") }
187
187
  end
188
188
  end
189
189
  end
@@ -201,7 +201,7 @@ module Alchemy
201
201
  end
202
202
 
203
203
  context 'for missing database config file' do
204
- before { File.stub(exists?: false) }
204
+ before { allow(File).to receive(:exists?).and_return( false) }
205
205
 
206
206
  it "raises error" do
207
207
  expect { Foo.database_config }.to raise_error(RuntimeError)
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'alchemy/essences/_essence_boolean_editor' do
4
+ let(:essence) { Alchemy::EssenceBoolean.new(ingredient: false) }
5
+ let(:content) { Alchemy::Content.new(essence: essence, name: 'Boolean') }
6
+
7
+ before do
8
+ allow(view).to receive(:render_content_name).and_return(content.name)
9
+ allow(view).to receive(:delete_content_link).and_return('')
10
+ end
11
+
12
+ it "renders a checkbox" do
13
+ render partial: "alchemy/essences/essence_boolean_editor", locals: {content: content}
14
+ expect(rendered).to have_selector('input[type="checkbox"]')
15
+ end
16
+
17
+ context 'with default value given in view local options' do
18
+ it "checks the checkbox" do
19
+ render partial: "alchemy/essences/essence_boolean_editor", locals: {content: content, options: {default_value: true}}
20
+ expect(rendered).to have_selector('input[type="checkbox"][checked="checked"]')
21
+ end
22
+ end
23
+
24
+ context 'with default value given in content settings' do
25
+ before { allow(content).to receive(:settings).and_return({default_value: true}) }
26
+
27
+ it "checks the checkbox" do
28
+ render partial: "alchemy/essences/essence_boolean_editor", locals: {content: content}
29
+ expect(rendered).to have_selector('input[type="checkbox"][checked="checked"]')
30
+ end
31
+ end
32
+ end
@@ -4,7 +4,7 @@ describe 'alchemy/essences/_essence_boolean_view' do
4
4
 
5
5
  context 'with true as ingredient' do
6
6
  let(:content) { Alchemy::EssenceBoolean.new(ingredient: true) }
7
- before { view.stub(:_t).and_return('true') }
7
+ before { allow(view).to receive(:_t).and_return('true') }
8
8
 
9
9
  it "renders true" do
10
10
  render content, content: content
@@ -14,7 +14,7 @@ describe 'alchemy/essences/_essence_boolean_view' do
14
14
 
15
15
  context 'with false as ingredient' do
16
16
  let(:content) { Alchemy::EssenceBoolean.new(ingredient: false) }
17
- before { view.stub(:_t).and_return('false') }
17
+ before { allow(view).to receive(:_t).and_return('false') }
18
18
 
19
19
  it "renders false" do
20
20
  render content, content: content
@@ -6,7 +6,7 @@ describe 'alchemy/essences/_essence_date_view' do
6
6
  let(:options) { {} }
7
7
 
8
8
  before do
9
- view.stub(:options).and_return(options)
9
+ allow(view).to receive(:options).and_return(options)
10
10
  end
11
11
 
12
12
  context "with date value" do
@@ -27,4 +27,15 @@ describe 'alchemy/essences/_essence_link_view' do
27
27
  expect(rendered).to eq('<a href="http://google.com">Google</a>')
28
28
  end
29
29
  end
30
+
31
+ context 'with text setting on content description' do
32
+ before do
33
+ allow(content).to receive(:settings).and_return({text: 'Yahoo'})
34
+ end
35
+
36
+ it "renders a link" do
37
+ render content.essence, content: content, options: options, html_options: {}
38
+ expect(rendered).to eq('<a href="http://google.com">Yahoo</a>')
39
+ end
40
+ end
30
41
  end
@@ -8,11 +8,11 @@ describe "essences/_essence_picture_view" do
8
8
  before do
9
9
  ActionView::Base.send(:include, Alchemy::UrlHelper)
10
10
  ActionView::Base.send(:include, Alchemy::EssencesHelper)
11
- view.stub(:configuration).and_return(:jpg)
11
+ allow(view).to receive(:configuration).and_return(:jpg)
12
12
  end
13
13
 
14
14
  context "with caption" do
15
- let(:options) { {show_caption: true} }
15
+ let(:options) { {} }
16
16
  let(:html_options) { {} }
17
17
 
18
18
  subject do
@@ -24,18 +24,64 @@ describe "essences/_essence_picture_view" do
24
24
  end
25
25
 
26
26
  it "should enclose the image in a <figure> element" do
27
- should have_selector('figure img')
27
+ is_expected.to have_selector('figure img')
28
+ end
29
+
30
+ it "should shows the caption" do
31
+ should have_selector('figure figcaption')
32
+ should have_content('This is a cute cat')
33
+ end
34
+
35
+ context "but disabled in the options" do
36
+ let(:options) { {show_caption: false} }
37
+
38
+ it "should not enclose the image in a <figure> element" do
39
+ should_not have_selector('figure img')
40
+ end
41
+
42
+ it "should not show the caption" do
43
+ should_not have_selector('figure figcaption')
44
+ should_not have_content('This is a cute cat')
45
+ end
46
+ end
47
+
48
+ context "but disabled in the content settings" do
49
+ before do
50
+ allow(content).to receive(:settings).and_return({show_caption: false})
51
+ end
52
+
53
+ it "should not enclose the image in a <figure> element" do
54
+ should_not have_selector('figure img')
55
+ end
56
+
57
+ it "should not show the caption" do
58
+ should_not have_selector('figure figcaption')
59
+ should_not have_content('This is a cute cat')
60
+ end
61
+
62
+ context 'but enabled in the options hash' do
63
+ let(:options) { {show_caption: true} }
64
+
65
+ it "should enclose the image in a <figure> element" do
66
+ should have_selector('figure img')
67
+ end
68
+
69
+ it "should shows the caption" do
70
+ should have_selector('figure figcaption')
71
+ should have_content('This is a cute cat')
72
+ end
73
+ end
28
74
  end
29
75
 
30
76
  context "and essence with css class" do
31
77
  before { essence_picture.css_class = 'left' }
32
78
 
33
79
  it "should have the class on the <figure> element" do
34
- should have_selector('figure.left img')
80
+ is_expected.to have_selector('figure.left img')
35
81
  end
36
82
 
37
83
  it "should not have the class on the <img> element" do
38
- should_not have_selector('figure img.left')
84
+ is_expected.not_to have_selector('figure img.left')
39
85
  end
40
86
  end
41
87
 
@@ -43,15 +89,15 @@ describe "essences/_essence_picture_view" do
43
89
  before { html_options[:class] = 'right' }
44
90
 
45
91
  it "should have the class from the html_options on the <figure> element" do
46
- should have_selector('figure.right img')
92
+ is_expected.to have_selector('figure.right img')
47
93
  end
48
94
 
49
95
  it "should not have the class from the essence on the <figure> element" do
50
- should_not have_selector('figure.left img')
96
+ is_expected.not_to have_selector('figure.left img')
51
97
  end
52
98
 
53
99
  it "should not have the class from the html_options on the <img> element" do
54
- should_not have_selector('figure img.right')
100
+ is_expected.not_to have_selector('figure img.right')
55
101
  end
56
102
  end
57
103
  end
@@ -69,16 +115,15 @@ describe "essences/_essence_picture_view" do
69
115
  end
70
116
 
71
117
  it "should enclose the image in a link tag" do
72
- should have_selector('a[href="/home"] img')
118
+ is_expected.to have_selector('a[href="/home"] img')
73
119
  end
74
120
 
75
121
  context "but disabled link option" do
76
122
  before { options[:disable_link] = true }
77
123
 
78
124
  it "should not enclose the image in a link tag" do
79
- should_not have_selector('a img')
125
+ is_expected.not_to have_selector('a img')
80
126
  end
81
127
  end
82
128
  end
83
-
84
129
  end
@@ -17,4 +17,16 @@ describe 'alchemy/essences/_essence_richtext_view' do
17
17
  expect(rendered).to_not have_selector('h1')
18
18
  end
19
19
  end
20
+
21
+ context 'with content.settings[:plain_text] true' do
22
+ before do
23
+ allow(content).to receive(:settings).and_return({plain_text: true})
24
+ end
25
+
26
+ it "renders the text body" do
27
+ render content.essence, content: content
28
+ expect(rendered).to have_content('Lorem ipsum dolor sit amet consectetur adipiscing elit.')
29
+ expect(rendered).to_not have_selector('h1')
30
+ end
31
+ end
20
32
  end
@@ -35,6 +35,18 @@ describe 'alchemy/essences/_essence_text_view' do
35
35
  expect(rendered).to_not have_selector('a')
36
36
  end
37
37
  end
38
+
39
+ context 'but with content settings disable_link set to true' do
40
+ before do
41
+ allow(content).to receive(:settings).and_return({disable_link: true})
42
+ end
43
+
44
+ it "only renders the ingredient" do
45
+ render content.essence, content: content
46
+ expect(rendered).to have_content('Hello World')
47
+ expect(rendered).to_not have_selector('a')
48
+ end
49
+ end
38
50
  end
39
51
 
40
52
  end
@@ -1,8 +1,11 @@
1
1
  tinymce.addI18n('de',{
2
2
  "Cut": "Ausschneiden",
3
+ "Heading 5": "\u00dcberschrift 5",
3
4
  "Header 2": "\u00dcberschrift 2",
4
5
  "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Ihr Browser unterst\u00fctzt leider keinen direkten Zugriff auf die Zwischenablage. Bitte benutzen Sie die Strg + X \/ C \/ V Tastenkombinationen.",
6
+ "Heading 4": "\u00dcberschrift 4",
5
7
  "Div": "Textblock",
8
+ "Heading 2": "\u00dcberschrift 2",
6
9
  "Paste": "Einf\u00fcgen",
7
10
  "Close": "Schlie\u00dfen",
8
11
  "Font Family": "Schriftart",
@@ -11,6 +14,8 @@ tinymce.addI18n('de',{
11
14
  "New document": "Neues Dokument",
12
15
  "Blockquote": "Zitat",
13
16
  "Numbered list": "Nummerierte Liste",
17
+ "Heading 1": "\u00dcberschrift 1",
18
+ "Headings": "\u00dcberschriften",
14
19
  "Increase indent": "Einzug vergr\u00f6\u00dfern",
15
20
  "Formats": "Formate",
16
21
  "Headers": "\u00dcberschriften",
@@ -34,6 +39,8 @@ tinymce.addI18n('de',{
34
39
  "Italic": "Kursiv",
35
40
  "Align center": "Zentriert ausrichten",
36
41
  "Header 5": "\u00dcberschrift 5",
42
+ "Heading 6": "\u00dcberschrift 6",
43
+ "Heading 3": "\u00dcberschrift 3",
37
44
  "Decrease indent": "Einzug verkleinern",
38
45
  "Header 4": "\u00dcberschrift 4",
39
46
  "Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Einf\u00fcgen ist nun im einfachen Textmodus. Inhalte werden ab jetzt als unformatierter Text eingef\u00fcgt, bis Sie diese Einstellung wieder ausschalten!",
@@ -59,6 +66,7 @@ tinymce.addI18n('de',{
59
66
  "Restore last draft": "Letzten Entwurf wiederherstellen",
60
67
  "Special character": "Sonderzeichen",
61
68
  "Source code": "Quelltext",
69
+ "Color": "Farbe",
62
70
  "Right to left": "Von rechts nach links",
63
71
  "Left to right": "Von links nach rechts",
64
72
  "Emoticons": "Emoticons",
@@ -121,11 +129,13 @@ tinymce.addI18n('de',{
121
129
  "Finish": "Ende",
122
130
  "Ignore all": "Alles Ignorieren",
123
131
  "Ignore": "Ignorieren",
132
+ "Add to Dictionary": "Zum W\u00f6rterbuch hinzuf\u00fcgen",
124
133
  "Insert row before": "Neue Zeile davor einf\u00fcgen ",
125
134
  "Rows": "Zeilen",
126
135
  "Height": "H\u00f6he",
127
136
  "Paste row after": "Zeile danach einf\u00fcgen",
128
137
  "Alignment": "Ausrichtung",
138
+ "Border color": "Rahmenfarbe",
129
139
  "Column group": "Spaltengruppe",
130
140
  "Row": "Zeile",
131
141
  "Insert column before": "Neue Spalte davor einf\u00fcgen",
@@ -141,15 +151,20 @@ tinymce.addI18n('de',{
141
151
  "Paste row before": "Zeile davor einf\u00fcgen",
142
152
  "Scope": "G\u00fcltigkeitsbereich",
143
153
  "Delete table": "Tabelle l\u00f6schen",
154
+ "H Align": "Horizontale Ausrichtung",
155
+ "Top": "Oben",
144
156
  "Header cell": "Kopfzelle",
145
157
  "Column": "Spalte",
158
+ "Row group": "Zeilengruppe",
146
159
  "Cell": "Zelle",
147
- "Header": "Kopfzeile",
160
+ "Middle": "Mitte",
148
161
  "Cell type": "Zellentyp",
149
162
  "Copy row": "Zeile kopieren",
150
163
  "Row properties": "Zeileneigenschaften",
151
164
  "Table properties": "Tabelleneigenschaften",
152
- "Row group": "Zeilengruppe",
165
+ "Bottom": "Unten",
166
+ "V Align": "Vertikale Ausrichtung",
167
+ "Header": "Kopfzeile",
153
168
  "Right": "Rechtsb\u00fcndig",
154
169
  "Insert column after": "Neue Spalte danach einf\u00fcgen",
155
170
  "Cols": "Spalten",
@@ -164,6 +179,9 @@ tinymce.addI18n('de',{
164
179
  "Insert template": "Vorlage einf\u00fcgen ",
165
180
  "Templates": "Vorlagen",
166
181
  "Background color": "Hintergrundfarbe",
182
+ "Custom...": "Benutzerdefiniert...",
183
+ "Custom color": "Benutzerdefinierte Farbe",
184
+ "No color": "Keine Farbe",
167
185
  "Text color": "Textfarbe",
168
186
  "Show blocks": " Bl\u00f6cke anzeigen",
169
187
  "Show invisible characters": "Unsichtbare Zeichen anzeigen",