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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -2
- data/Gemfile +1 -0
- data/alchemy_cms.gemspec +6 -6
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -7
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +4 -4
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +51 -5
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +0 -2
- data/app/assets/stylesheets/alchemy/elements.scss +2 -2
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +11 -3
- data/app/controllers/alchemy/admin/pictures_controller.rb +1 -0
- data/app/models/alchemy/element.rb +3 -1
- data/app/models/alchemy/element/element_contents.rb +2 -7
- data/app/models/alchemy/element/presenters.rb +11 -4
- data/app/models/alchemy/page.rb +3 -1
- data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
- data/app/views/alchemy/admin/contents/create.js.erb +0 -1
- data/app/views/alchemy/admin/elements/_element_header.html.erb +3 -1
- data/app/views/alchemy/admin/elements/order.js.erb +25 -10
- data/app/views/alchemy/admin/elements/update.js.erb +1 -2
- data/app/views/alchemy/admin/essence_files/assign.js.erb +0 -1
- data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -1
- data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +0 -1
- data/app/views/alchemy/admin/pages/destroy.js.erb +0 -1
- data/app/views/alchemy/admin/pages/update.js.erb +6 -4
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +2 -1
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -7
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +0 -1
- data/bin/alchemy +1 -1
- data/bin/rspec +3 -2
- data/bin/spring +6 -6
- data/config/alchemy/config.yml +6 -1
- data/lib/alchemy/seeder.rb +9 -3
- data/lib/alchemy/version.rb +1 -1
- metadata +6 -471
- data/spec/controllers/alchemy/admin/attachments_controller_spec.rb +0 -193
- data/spec/controllers/alchemy/admin/base_controller_spec.rb +0 -87
- data/spec/controllers/alchemy/admin/clipboard_controller_spec.rb +0 -60
- data/spec/controllers/alchemy/admin/contents_controller_spec.rb +0 -78
- data/spec/controllers/alchemy/admin/dashboard_controller_spec.rb +0 -144
- data/spec/controllers/alchemy/admin/elements_controller_spec.rb +0 -496
- data/spec/controllers/alchemy/admin/essence_files_controller_spec.rb +0 -76
- data/spec/controllers/alchemy/admin/essence_pictures_controller_spec.rb +0 -202
- data/spec/controllers/alchemy/admin/languages_controller_spec.rb +0 -73
- data/spec/controllers/alchemy/admin/layoutpages_controller_spec.rb +0 -21
- data/spec/controllers/alchemy/admin/pages_controller_spec.rb +0 -639
- data/spec/controllers/alchemy/admin/pictures_controller_spec.rb +0 -383
- data/spec/controllers/alchemy/admin/resources_controller_spec.rb +0 -81
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +0 -63
- data/spec/controllers/alchemy/admin/trash_controller_spec.rb +0 -67
- data/spec/controllers/alchemy/api/contents_controller_spec.rb +0 -125
- data/spec/controllers/alchemy/api/elements_controller_spec.rb +0 -124
- data/spec/controllers/alchemy/api/pages_controller_spec.rb +0 -167
- data/spec/controllers/alchemy/attachments_controller_spec.rb +0 -64
- data/spec/controllers/alchemy/base_controller_spec.rb +0 -106
- data/spec/controllers/alchemy/elements_controller_spec.rb +0 -48
- data/spec/controllers/alchemy/messages_controller_spec.rb +0 -204
- data/spec/controllers/alchemy/on_page_layout_mixin_spec.rb +0 -330
- data/spec/controllers/alchemy/pages_controller_spec.rb +0 -343
- data/spec/controllers/alchemy/pictures_controller_spec.rb +0 -415
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/admin/events_controller.rb +0 -3
- data/spec/dummy/app/controllers/application_controller.rb +0 -15
- data/spec/dummy/app/controllers/login_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/ability.rb +0 -9
- data/spec/dummy/app/models/dummy_model.rb +0 -3
- data/spec/dummy/app/models/dummy_user.rb +0 -15
- data/spec/dummy/app/models/event.rb +0 -10
- data/spec/dummy/app/models/location.rb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +0 -11
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_view.html.erb +0 -31
- data/spec/dummy/app/views/alchemy/elements/_article_editor.html.erb +0 -6
- data/spec/dummy/app/views/alchemy/elements/_article_view.html.erb +0 -10
- data/spec/dummy/app/views/alchemy/elements/_bild_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_bild_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_contactform_editor.html.erb +0 -6
- data/spec/dummy/app/views/alchemy/elements/_contactform_view.html.erb +0 -16
- data/spec/dummy/app/views/alchemy/elements/_download_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_download_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_erb_element_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_erb_element_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_header_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_header_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_headline_view.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_news_editor.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_news_view.html.erb +0 -11
- data/spec/dummy/app/views/alchemy/elements/_search_editor.html.erb +0 -1
- data/spec/dummy/app/views/alchemy/elements/_search_view.html.erb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_slide_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_slide_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/elements/_slider_editor.html.erb +0 -2
- data/spec/dummy/app/views/alchemy/elements/_slider_view.html.erb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_text_editor.html.erb +0 -3
- data/spec/dummy/app/views/alchemy/elements/_text_view.html.erb +0 -5
- data/spec/dummy/app/views/alchemy/page_layouts/_standard.html.erb +0 -15
- data/spec/dummy/app/views/layouts/application.html.erb +0 -17
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/alchemy/cells.yml +0 -5
- data/spec/dummy/config/alchemy/elements.yml +0 -109
- data/spec/dummy/config/alchemy/page_layouts.yml +0 -32
- data/spec/dummy/config/application.rb +0 -32
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -32
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -77
- data/spec/dummy/config/environments/test.rb +0 -43
- data/spec/dummy/config/initializers/alchemy.rb +0 -3
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/kl.yml +0 -2
- data/spec/dummy/config/routes.rb +0 -12
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/migrate/20121026104128_create_events.rb +0 -20
- data/spec/dummy/db/migrate/20130328101418_create_locations.rb +0 -9
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -1
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +0 -1
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +0 -1
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +0 -1
- data/spec/dummy/db/migrate/20131209225243_create_dummy_users.rb +0 -9
- data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +0 -31
- data/spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb +0 -20
- data/spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +0 -15
- data/spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb +0 -10
- data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +0 -7
- data/spec/dummy/db/migrate/20150608204610_add_parent_element_id_to_alchemy_elements.rb +0 -1
- data/spec/dummy/db/migrate/20150729151825_add_link_text_to_alchemy_essence_files.rb +0 -1
- data/spec/dummy/db/migrate/20150906195818_add_locale_to_alchemy_languages.rb +0 -1
- data/spec/dummy/db/schema.rb +0 -326
- data/spec/dummy/db/seeds.rb +0 -1
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/javascripts +0 -1
- data/spec/factories.rb +0 -13
- data/spec/features/admin/admin_layout_spec.rb +0 -14
- data/spec/features/admin/dashboard_spec.rb +0 -81
- data/spec/features/admin/edit_elements_feature_spec.rb +0 -36
- data/spec/features/admin/language_tree_feature_spec.rb +0 -32
- data/spec/features/admin/languages_features_spec.rb +0 -65
- data/spec/features/admin/legacy_page_url_management_spec.rb +0 -62
- data/spec/features/admin/link_overlay_spec.rb +0 -53
- data/spec/features/admin/locale_select_feature_spec.rb +0 -25
- data/spec/features/admin/modules_integration_spec.rb +0 -23
- data/spec/features/admin/navigation_feature_spec.rb +0 -22
- data/spec/features/admin/page_creation_feature_spec.rb +0 -51
- data/spec/features/admin/page_editing_feature_spec.rb +0 -135
- data/spec/features/admin/picture_library_integration_spec.rb +0 -62
- data/spec/features/admin/resources_integration_spec.rb +0 -128
- data/spec/features/admin/site_select_feature_spec.rb +0 -31
- data/spec/features/admin/tinymce_feature_spec.rb +0 -33
- data/spec/features/navigation_spec.rb +0 -9
- data/spec/features/page_feature_spec.rb +0 -186
- data/spec/features/page_redirects_spec.rb +0 -358
- data/spec/features/picture_security_spec.rb +0 -29
- data/spec/features/security_spec.rb +0 -24
- data/spec/features/translation_integration_spec.rb +0 -51
- data/spec/fixtures/500x500.png +0 -0
- data/spec/fixtures/80x60.png +0 -0
- data/spec/fixtures/animated.gif +0 -0
- data/spec/fixtures/image with spaces.png +0 -0
- data/spec/fixtures/image.png +0 -0
- data/spec/fixtures/image2.PNG +0 -0
- data/spec/fixtures/image3.jpeg +0 -0
- data/spec/helpers/alchemy/admin/attachments_helper_spec.rb +0 -15
- data/spec/helpers/alchemy/admin/base_helper_spec.rb +0 -280
- data/spec/helpers/alchemy/admin/contents_helper_spec.rb +0 -46
- data/spec/helpers/alchemy/admin/elements_helper_spec.rb +0 -314
- data/spec/helpers/alchemy/admin/essences_helper_spec.rb +0 -201
- data/spec/helpers/alchemy/admin/navigation_helper_spec.rb +0 -294
- data/spec/helpers/alchemy/admin/pages_helper_spec.rb +0 -63
- data/spec/helpers/alchemy/admin/pictures_helper_spec.rb +0 -28
- data/spec/helpers/alchemy/admin/tags_helper_spec.rb +0 -111
- data/spec/helpers/alchemy/base_helper_spec.rb +0 -44
- data/spec/helpers/alchemy/elements_block_helper_spec.rb +0 -135
- data/spec/helpers/alchemy/elements_helper_spec.rb +0 -326
- data/spec/helpers/alchemy/essences_helper_spec.rb +0 -85
- data/spec/helpers/alchemy/pages_helper_spec.rb +0 -499
- data/spec/helpers/alchemy/picture_url_helpers_spec.rb +0 -78
- data/spec/helpers/alchemy/url_helper_spec.rb +0 -200
- data/spec/javascripts/alchemy/dialog_spec.coffee +0 -82
- data/spec/javascripts/alchemy/link_overlay_spec.coffee +0 -25
- data/spec/javascripts/alchemy_integration_spec.coffee +0 -3
- data/spec/javascripts/fixtures/select.html +0 -3
- data/spec/javascripts/helpers/mock-ajax.js +0 -199
- data/spec/javascripts/helpers/test_responses/test_responses.js +0 -1
- data/spec/javascripts/support/jasmine.yml +0 -29
- data/spec/libraries/auth_accessors_spec.rb +0 -40
- data/spec/libraries/config_spec.rb +0 -111
- data/spec/libraries/controller_actions_spec.rb +0 -133
- data/spec/libraries/i18n_spec.rb +0 -37
- data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +0 -30
- data/spec/libraries/modules_spec.rb +0 -67
- data/spec/libraries/mount_point_spec.rb +0 -77
- data/spec/libraries/page_layout_spec.rb +0 -150
- data/spec/libraries/paths_spec.rb +0 -15
- data/spec/libraries/permissions_spec.rb +0 -260
- data/spec/libraries/resource_spec.rb +0 -344
- data/spec/libraries/resources_helper_spec.rb +0 -193
- data/spec/libraries/shell_spec.rb +0 -121
- data/spec/libraries/template_tracker_spec.rb +0 -85
- data/spec/libraries/tinymce_spec.rb +0 -111
- data/spec/libraries/userstamp_spec.rb +0 -10
- data/spec/mailers/alchemy/messages_spec.rb +0 -21
- data/spec/models/alchemy/attachment_spec.rb +0 -250
- data/spec/models/alchemy/cell_spec.rb +0 -101
- data/spec/models/alchemy/content_spec.rb +0 -513
- data/spec/models/alchemy/element_spec.rb +0 -862
- data/spec/models/alchemy/element_to_page_spec.rb +0 -13
- data/spec/models/alchemy/essence_boolean_spec.rb +0 -10
- data/spec/models/alchemy/essence_date_spec.rb +0 -28
- data/spec/models/alchemy/essence_file_spec.rb +0 -40
- data/spec/models/alchemy/essence_html_spec.rb +0 -18
- data/spec/models/alchemy/essence_link_spec.rb +0 -10
- data/spec/models/alchemy/essence_picture_spec.rb +0 -255
- data/spec/models/alchemy/essence_richtext_spec.rb +0 -23
- data/spec/models/alchemy/essence_select_spec.rb +0 -10
- data/spec/models/alchemy/essence_text_spec.rb +0 -110
- data/spec/models/alchemy/language_spec.rb +0 -243
- data/spec/models/alchemy/legacy_page_url_spec.rb +0 -21
- data/spec/models/alchemy/message_spec.rb +0 -55
- data/spec/models/alchemy/page_spec.rb +0 -2108
- data/spec/models/alchemy/picture_spec.rb +0 -418
- data/spec/models/alchemy/site_spec.rb +0 -168
- data/spec/models/alchemy/tag_spec.rb +0 -29
- data/spec/models/dummy_model_spec.rb +0 -10
- data/spec/requests/alchemy/admin/resources_requests_spec.rb +0 -26
- data/spec/requests/alchemy/admin/site_requests_spec.rb +0 -19
- data/spec/requests/alchemy/site_requests_spec.rb +0 -18
- data/spec/requests/alchemy/sitemap_spec.rb +0 -56
- data/spec/routing/api_routing_spec.rb +0 -150
- data/spec/routing/routing_spec.rb +0 -340
- data/spec/spec_helper.rb +0 -90
- data/spec/support/ci/install_phantomjs +0 -7
- data/spec/support/hint_examples.rb +0 -28
- data/spec/support/test_tweaks.rb +0 -31
- data/spec/support/transformation_examples.rb +0 -179
- data/spec/tasks/helpers_spec.rb +0 -217
- data/spec/views/admin/pictures/show_spec.rb +0 -43
- data/spec/views/essences/essence_boolean_editor_spec.rb +0 -32
- data/spec/views/essences/essence_boolean_view_spec.rb +0 -23
- data/spec/views/essences/essence_date_view_spec.rb +0 -38
- data/spec/views/essences/essence_file_editor_spec.rb +0 -59
- data/spec/views/essences/essence_file_view_spec.rb +0 -77
- data/spec/views/essences/essence_html_view_spec.rb +0 -22
- data/spec/views/essences/essence_link_view_spec.rb +0 -41
- data/spec/views/essences/essence_picture_editor_spec.rb +0 -80
- data/spec/views/essences/essence_picture_view_spec.rb +0 -128
- data/spec/views/essences/essence_richtext_view_spec.rb +0 -32
- data/spec/views/essences/essence_select_view_spec.rb +0 -11
- data/spec/views/essences/essence_text_view_spec.rb +0 -51
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssenceDate do
|
5
|
-
let(:essence) { EssenceDate.new }
|
6
|
-
|
7
|
-
it_behaves_like "an essence" do
|
8
|
-
let(:essence) { EssenceDate.new }
|
9
|
-
let(:ingredient_value) { DateTime.current }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#preview_text' do
|
13
|
-
context "if no date set" do
|
14
|
-
it "should return an empty string" do
|
15
|
-
expect(essence.preview_text).to eq("")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "if date set" do
|
20
|
-
it "should format the date by i18n" do
|
21
|
-
essence.date = DateTime.current
|
22
|
-
expect(::I18n).to receive(:l).with(essence.date, format: :date)
|
23
|
-
essence.preview_text
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssenceFile do
|
5
|
-
let(:attachment) { build_stubbed(:alchemy_attachment) }
|
6
|
-
let(:essence) { EssenceFile.new(attachment: attachment) }
|
7
|
-
|
8
|
-
it_behaves_like "an essence" do
|
9
|
-
let(:essence) { EssenceFile.new }
|
10
|
-
let(:ingredient_value) { attachment }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#attachment_url' do
|
14
|
-
subject { essence.attachment_url }
|
15
|
-
|
16
|
-
it "returns the download attachment url." do
|
17
|
-
is_expected.to match(/\/attachment\/#{attachment.id}\/download\/#{attachment.urlname}\.#{attachment.suffix}/)
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'without attachment assigned' do
|
21
|
-
let(:attachment) { nil }
|
22
|
-
|
23
|
-
it { is_expected.to be_nil }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#preview_text' do
|
28
|
-
it "returns the attachment's name as preview text" do
|
29
|
-
expect(essence.preview_text).to eq(attachment.name)
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with no attachment assigned" do
|
33
|
-
it "returns empty string" do
|
34
|
-
essence.attachment = nil
|
35
|
-
expect(essence.preview_text).to eq('')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssenceHtml do
|
5
|
-
let(:essence) { EssenceHtml.new(source: '<p>hello!</p>') }
|
6
|
-
|
7
|
-
it_behaves_like "an essence" do
|
8
|
-
let(:essence) { EssenceHtml.new }
|
9
|
-
let(:ingredient_value) { '<p>hello!</p>' }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#preview_text' do
|
13
|
-
it "should return html escaped source code" do
|
14
|
-
expect(essence.preview_text).to eq('<p>hello!</p>')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,255 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssencePicture do
|
5
|
-
it_behaves_like "an essence" do
|
6
|
-
let(:essence) { EssencePicture.new }
|
7
|
-
let(:ingredient_value) { Picture.new }
|
8
|
-
end
|
9
|
-
|
10
|
-
it_behaves_like "has image transformations" do
|
11
|
-
let(:picture) { build_stubbed(:alchemy_essence_picture) }
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should not store negative values for crop values" do
|
15
|
-
essence = EssencePicture.new(crop_from: '-1x100', crop_size: '-20x30')
|
16
|
-
essence.save!
|
17
|
-
expect(essence.crop_from).to eq("0x100")
|
18
|
-
expect(essence.crop_size).to eq("0x30")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should not store float values for crop values" do
|
22
|
-
essence = EssencePicture.new(crop_from: '0.05x104.5', crop_size: '99.5x203.4')
|
23
|
-
essence.save!
|
24
|
-
expect(essence.crop_from).to eq("0x105")
|
25
|
-
expect(essence.crop_size).to eq("100x203")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should convert newlines in caption into <br/>s" do
|
29
|
-
essence = EssencePicture.new(caption: "hello\nkitty")
|
30
|
-
essence.save!
|
31
|
-
expect(essence.caption).to eq("hello<br/>kitty")
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#picture_url' do
|
35
|
-
subject { essence.picture_url(options) }
|
36
|
-
|
37
|
-
let(:options) { {} }
|
38
|
-
let(:picture) { build_stubbed(:alchemy_picture) }
|
39
|
-
let(:essence) { build_stubbed(:alchemy_essence_picture, picture: picture) }
|
40
|
-
|
41
|
-
it "returns the show picture url." do
|
42
|
-
is_expected.to match(/\/pictures\/#{picture.id}\/show\/#{picture.urlname}\.#{Config.get(:image_output_format)}/)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "includes the secure hash." do
|
46
|
-
is_expected.to match(/\?sh=\S+\z/)
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with size in the options' do
|
50
|
-
let(:options) { {size: '200x300'} }
|
51
|
-
|
52
|
-
it "includes the size in the url." do
|
53
|
-
is_expected.to match(/200x300/)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'with no format in the options' do
|
58
|
-
it "includes the default image output format." do
|
59
|
-
is_expected.to match(/#{Config.get(:image_output_format)}/)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'with format in the options' do
|
64
|
-
let(:options) { {format: 'png'} }
|
65
|
-
|
66
|
-
it "takes this as format." do
|
67
|
-
is_expected.to match(/png/)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'when cropping is allowed' do
|
72
|
-
let(:options) { {crop: true} }
|
73
|
-
|
74
|
-
it 'converts the value `true` of the `crop` option into `crop` as part of the url' do
|
75
|
-
is_expected.to match /crop/
|
76
|
-
is_expected.not_to match /true/
|
77
|
-
end
|
78
|
-
|
79
|
-
context 'and crop sizes are set' do
|
80
|
-
before do
|
81
|
-
expect(essence).to receive(:crop_size).at_least(:once).and_return('200x200')
|
82
|
-
expect(essence).to receive(:crop_from).at_least(:once).and_return('10x10')
|
83
|
-
end
|
84
|
-
|
85
|
-
it "includes the crop sizes in the url." do
|
86
|
-
is_expected.to match(/200x200/)
|
87
|
-
is_expected.to match(/10x10/)
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'but with crop sizes in the options' do
|
91
|
-
before do
|
92
|
-
options.update({crop_from: '30x30', crop_size: '75x75'})
|
93
|
-
end
|
94
|
-
|
95
|
-
it "includes these crop sizes instead." do
|
96
|
-
is_expected.to match(/30x30/)
|
97
|
-
is_expected.to match(/75x75/)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when cropping is prohibited' do
|
104
|
-
before do
|
105
|
-
expect(essence).not_to receive(:crop_size)
|
106
|
-
expect(essence).not_to receive(:crop_from)
|
107
|
-
end
|
108
|
-
|
109
|
-
context 'without setting `crop` in the options' do
|
110
|
-
it "does not include `crop` in the url" do
|
111
|
-
is_expected.not_to match(/crop/)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'when `crop` is explicitly set to `false`' do
|
116
|
-
let(:options) { {crop: false} }
|
117
|
-
|
118
|
-
it "does not include `crop` in the url" do
|
119
|
-
is_expected.not_to match(/crop/)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context 'even when crop sizes are set' do
|
124
|
-
it "does not include any cropping information in the url" do
|
125
|
-
is_expected.not_to match(/crop/)
|
126
|
-
is_expected.not_to match(/200x200/)
|
127
|
-
is_expected.not_to match(/10x10/)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
context 'with `image_size` in the options' do
|
133
|
-
let(:options) { {image_size: '100x100'} }
|
134
|
-
|
135
|
-
it 'converts the key into `size`' do
|
136
|
-
is_expected.to match /100x100/
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context 'with other options' do
|
141
|
-
let(:options) { {foo: 'baz'} }
|
142
|
-
|
143
|
-
it 'it removes them from params' do
|
144
|
-
is_expected.not_to match /foo/
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'without picture assigned' do
|
149
|
-
let(:picture) { nil }
|
150
|
-
|
151
|
-
it { is_expected.to be_nil }
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe '#cropping_mask' do
|
156
|
-
subject { essence.cropping_mask }
|
157
|
-
|
158
|
-
context 'with crop values given' do
|
159
|
-
let(:essence) { build_stubbed(:alchemy_essence_picture, crop_from: '0x0', crop_size: '100x100') }
|
160
|
-
|
161
|
-
it "returns a hash containing cropping coordinates" do
|
162
|
-
is_expected.to eq({x1: 0, y1: 0, x2: 100, y2: 100})
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
context 'with no crop values given' do
|
167
|
-
let(:essence) { build_stubbed(:alchemy_essence_picture) }
|
168
|
-
|
169
|
-
it { is_expected.to be_nil }
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
describe '#preview_text' do
|
174
|
-
let(:picture) { mock_model(Picture, name: 'Cute Cat Kittens') }
|
175
|
-
let(:essence) { EssencePicture.new }
|
176
|
-
|
177
|
-
it "should return the pictures name as preview text" do
|
178
|
-
allow(essence).to receive(:picture).and_return(picture)
|
179
|
-
expect(essence.preview_text).to eq('Cute Cat Kittens')
|
180
|
-
end
|
181
|
-
|
182
|
-
context "with no picture assigned" do
|
183
|
-
it "returns empty string" do
|
184
|
-
expect(essence.preview_text).to eq('')
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
describe '#serialized_ingredient' do
|
190
|
-
let(:content) { Content.new }
|
191
|
-
let(:picture) { mock_model(Picture, name: 'Cute Cat Kittens', urlname: 'cute-cat-kittens', security_token: 'kljhgfd') }
|
192
|
-
let(:essence) { EssencePicture.new(content: content, picture: picture) }
|
193
|
-
|
194
|
-
it "returns the url to render the picture" do
|
195
|
-
expect(essence.serialized_ingredient).to eq("/pictures/#{picture.id}/show/#{picture.urlname}.jpg?sh=#{picture.security_token}")
|
196
|
-
end
|
197
|
-
|
198
|
-
context 'with image settings given at content' do
|
199
|
-
before do
|
200
|
-
expect(content).to receive(:settings).and_return({size: '150x150', format: 'png', select_values: [1, 2, 3]})
|
201
|
-
end
|
202
|
-
|
203
|
-
it "returns the url with cropping and resizing options" do
|
204
|
-
expect(essence.serialized_ingredient).to eq("/pictures/#{picture.id}/show/150x150/#{picture.urlname}.png?sh=#{picture.security_token}")
|
205
|
-
end
|
206
|
-
|
207
|
-
it "rejects options that are not cropping and resizing options" do
|
208
|
-
expect(essence.serialized_ingredient).to_not match("select_values")
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
describe "#allow_image_cropping?" do
|
214
|
-
let(:essence_picture) { stub_model(Alchemy::EssencePicture) }
|
215
|
-
let(:content) { stub_model(Alchemy::Content) }
|
216
|
-
let(:picture) { stub_model(Alchemy::Picture) }
|
217
|
-
|
218
|
-
subject { essence_picture.allow_image_cropping? }
|
219
|
-
|
220
|
-
it { is_expected.to be_falsy }
|
221
|
-
|
222
|
-
context "with content existing?" do
|
223
|
-
before do
|
224
|
-
allow(essence_picture).to receive(:content) { content }
|
225
|
-
end
|
226
|
-
|
227
|
-
it { is_expected.to be_falsy }
|
228
|
-
|
229
|
-
context "with picture assigned" do
|
230
|
-
before do
|
231
|
-
allow(essence_picture).to receive(:picture) { picture }
|
232
|
-
end
|
233
|
-
|
234
|
-
it { is_expected.to be_falsy }
|
235
|
-
|
236
|
-
context "and with image larger than crop size" do
|
237
|
-
before do
|
238
|
-
allow(picture).to receive(:can_be_cropped_to) { true }
|
239
|
-
end
|
240
|
-
|
241
|
-
it { is_expected.to be_falsy }
|
242
|
-
|
243
|
-
context "with crop set to true" do
|
244
|
-
before do
|
245
|
-
allow(content).to receive(:settings_value) { true }
|
246
|
-
end
|
247
|
-
|
248
|
-
it { is_expected.to be(true) }
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssenceRichtext do
|
5
|
-
let(:essence) do
|
6
|
-
EssenceRichtext.new(body: '<h1>Hello!</h1><p>Welcome to Peters Petshop.</p>')
|
7
|
-
end
|
8
|
-
|
9
|
-
it_behaves_like "an essence" do
|
10
|
-
let(:essence) { EssenceRichtext.new }
|
11
|
-
let(:ingredient_value) { '<h1>Hello!</h1><p>Welcome to Peters Petshop.</p>' }
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should save a HTML tag free version of body column" do
|
15
|
-
essence.save
|
16
|
-
expect(essence.stripped_body).to eq("Hello!Welcome to Peters Petshop.")
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'has tinymce enabled' do
|
20
|
-
expect(essence.has_tinymce?).to eq(true)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe EssenceText do
|
5
|
-
let(:essence) { EssenceText.new }
|
6
|
-
let(:ingredient_value) { 'Lorem ipsum' }
|
7
|
-
|
8
|
-
it_behaves_like "an essence" do
|
9
|
-
let(:essence) { EssenceText.new }
|
10
|
-
let(:ingredient_value) { 'Lorem ipsum' }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#preview_text' do
|
14
|
-
before do
|
15
|
-
ingredient_column = essence.ingredient_column
|
16
|
-
essence.send("#{ingredient_column}=", ingredient_value)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should return a preview text" do
|
20
|
-
expect(essence.preview_text).to eq(ingredient_value.to_s)
|
21
|
-
end
|
22
|
-
|
23
|
-
context "with given maxlength" do
|
24
|
-
it "should return as much beginning characters as defined with maxlength" do
|
25
|
-
expect(essence.preview_text(2)).to eq(ingredient_value.to_s[0..1])
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with another preview_text_column defined" do
|
30
|
-
before do
|
31
|
-
allow(essence).to receive(:title).and_return('Title column')
|
32
|
-
allow(essence).to receive(:preview_text_column).and_return(:title)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should use this column as preview text method" do
|
36
|
-
expect(essence.preview_text).to eq('Title column')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#open_link_in_new_window?' do
|
42
|
-
let(:essence) { EssenceText.new }
|
43
|
-
subject { essence.open_link_in_new_window? }
|
44
|
-
|
45
|
-
context 'essence responds to link_taget' do
|
46
|
-
context 'if link_target attribute is set to "blank"' do
|
47
|
-
before { essence.link_target = 'blank' }
|
48
|
-
|
49
|
-
it "should return true" do
|
50
|
-
expect(subject).to eq(true)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'if link_target attribute is not "blank"' do
|
55
|
-
it "should return false" do
|
56
|
-
expect(subject).to eq(false)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'validations' do
|
63
|
-
describe 'format' do
|
64
|
-
context 'given a regex string' do
|
65
|
-
before do
|
66
|
-
allow(essence).to receive(:definition).and_return({'validate' => [{'format' => /\Ahttps:\/\/[\S]+/}]})
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when ingredient string does not match the given regex' do
|
70
|
-
before { essence.update(essence.ingredient_column.to_sym => 'http://alchemy-cms.com') }
|
71
|
-
|
72
|
-
it 'should not be valid' do
|
73
|
-
expect(essence).to_not be_valid
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'when ingredient string matches the given regex' do
|
78
|
-
before { essence.update(essence.ingredient_column.to_sym => 'https://alchemy-cms.com') }
|
79
|
-
|
80
|
-
it 'should be valid' do
|
81
|
-
expect(essence).to be_valid
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'given a key from the config`s format_matcher list' do
|
87
|
-
before do
|
88
|
-
allow(essence).to receive(:definition).and_return({'validate' => [{'format' => 'email'}]})
|
89
|
-
end
|
90
|
-
|
91
|
-
context 'when ingredient string does not match the given format matcher' do
|
92
|
-
before { essence.update(essence.ingredient_column.to_sym => ingredient_value) }
|
93
|
-
|
94
|
-
it 'should not be valid' do
|
95
|
-
expect(essence).to_not be_valid
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'when ingredient string matches the given format matcher' do
|
100
|
-
before { essence.update(essence.ingredient_column.to_sym => 'email@email.com') }
|
101
|
-
|
102
|
-
it 'should be valid' do
|
103
|
-
expect(essence).to be_valid
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|