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,43 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "alchemy/admin/pictures/show.html.erb" do
|
4
|
-
let(:image) do
|
5
|
-
fixture_file_upload(
|
6
|
-
File.expand_path('../../../../fixtures/animated.gif', __FILE__),
|
7
|
-
'image/gif'
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:picture) do
|
12
|
-
build_stubbed(:alchemy_picture, {
|
13
|
-
image_file: image,
|
14
|
-
name: 'animated',
|
15
|
-
image_file_name: 'animated.gif'
|
16
|
-
})
|
17
|
-
end
|
18
|
-
|
19
|
-
before do
|
20
|
-
allow(view).to receive(:admin_picture_path).and_return("/path")
|
21
|
-
allow(view).to receive(:render_message) {}
|
22
|
-
view.extend Alchemy::Admin::FormHelper
|
23
|
-
end
|
24
|
-
|
25
|
-
it "displays picture in original format" do
|
26
|
-
assign(:picture, picture)
|
27
|
-
assign(:pages, [])
|
28
|
-
|
29
|
-
render
|
30
|
-
|
31
|
-
expect(rendered).to have_selector('img[src*="gif"]')
|
32
|
-
end
|
33
|
-
|
34
|
-
it "separates the tags with a comma" do
|
35
|
-
allow(picture).to receive(:tag_list).and_return(["one", "two", "three"])
|
36
|
-
assign(:picture, picture)
|
37
|
-
assign(:pages, [])
|
38
|
-
|
39
|
-
render
|
40
|
-
|
41
|
-
expect(rendered).to have_selector('input[value*="one,two,three"]')
|
42
|
-
end
|
43
|
-
end
|
@@ -1,32 +0,0 @@
|
|
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(:render_hint_for).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
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_boolean_view' do
|
4
|
-
context 'with true as ingredient' do
|
5
|
-
let(:content) { Alchemy::EssenceBoolean.new(ingredient: true) }
|
6
|
-
before { allow(Alchemy).to receive(:t).and_return('true') }
|
7
|
-
|
8
|
-
it "renders true" do
|
9
|
-
render content, content: content
|
10
|
-
expect(rendered).to have_content('true')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with false as ingredient' do
|
15
|
-
let(:content) { Alchemy::EssenceBoolean.new(ingredient: false) }
|
16
|
-
before { allow(Alchemy).to receive(:t).and_return('false') }
|
17
|
-
|
18
|
-
it "renders false" do
|
19
|
-
render content, content: content
|
20
|
-
expect(rendered).to have_content('false')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_date_view' do
|
4
|
-
let(:essence) { Alchemy::EssenceDate.new(date: '2013-10-27 21:14:16 +0100'.to_datetime) }
|
5
|
-
let(:content) { Alchemy::Content.new(essence: essence) }
|
6
|
-
let(:options) { {} }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(view).to receive(:options).and_return(options)
|
10
|
-
end
|
11
|
-
|
12
|
-
context "with date value" do
|
13
|
-
context 'without date_format passed' do
|
14
|
-
it "translates the date value with default format" do
|
15
|
-
render content, content: content
|
16
|
-
expect(rendered).to have_content('Sun, 27 Oct 2013 20:14:16 +0000')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with option date_format set to rfc822' do
|
21
|
-
let(:options) { {date_format: 'rfc822'} }
|
22
|
-
|
23
|
-
it "renders the date rfc822 conform" do
|
24
|
-
render content, content: content
|
25
|
-
expect(rendered).to have_content('Sun, 27 Oct 2013 20:14:16 +0000')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with blank date value' do
|
31
|
-
let(:essence) { Alchemy::EssenceDate.new(date: nil) }
|
32
|
-
|
33
|
-
it "renders nothing" do
|
34
|
-
render content, content: content
|
35
|
-
expect(rendered).to eq('')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_editor_view' do
|
4
|
-
let(:attachment) { build_stubbed(:alchemy_attachment) }
|
5
|
-
let(:essence) { build_stubbed(:alchemy_essence_file, attachment: attachment) }
|
6
|
-
let(:content) { build_stubbed(:alchemy_content, essence: essence) }
|
7
|
-
|
8
|
-
subject do
|
9
|
-
render partial: "alchemy/essences/essence_file_editor", locals: {content: content}
|
10
|
-
rendered
|
11
|
-
end
|
12
|
-
|
13
|
-
before do
|
14
|
-
view.class.send :include, Alchemy::Admin::BaseHelper
|
15
|
-
allow(view).to receive(:content_label).and_return('')
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'with ingredient present' do
|
19
|
-
before do
|
20
|
-
allow(content).to receive(:ingredient).and_return(attachment)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "renders a hidden field with attachment id" do
|
24
|
-
is_expected.to have_selector("input[type='hidden'][value='#{attachment.id}']")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "renders a link to open the attachment library overlay" do
|
28
|
-
is_expected.to have_selector("a.assign_file[href='/admin/attachments?content_id=#{content.id}&options=%7B%7D']")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "renders a link to edit the essence" do
|
32
|
-
is_expected.to have_selector("a.edit_file[href='/admin/essence_files/#{essence.id}/edit?options=%7B%7D']")
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'with content settings `only`' do
|
36
|
-
it "renders a link to open the attachment library overlay with only pdfs" do
|
37
|
-
expect(content).to receive(:settings).at_least(:once).and_return({only: 'pdf'})
|
38
|
-
is_expected.to have_selector("a.assign_file[href='/admin/attachments?content_id=#{content.id}&only=pdf&options=%7B%7D']")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'with content settings `except`' do
|
43
|
-
it "renders a link to open the attachment library overlay without pdfs" do
|
44
|
-
expect(content).to receive(:settings).at_least(:once).and_return({except: 'pdf'})
|
45
|
-
is_expected.to have_selector("a.assign_file[href='/admin/attachments?content_id=#{content.id}&except=pdf&options=%7B%7D']")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'without ingredient present' do
|
51
|
-
before do
|
52
|
-
allow(content).to receive(:ingredient).and_return(nil)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "does not render a hidden field with attachment id" do
|
56
|
-
is_expected.to_not have_selector("input[type='hidden']")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_file_view' do
|
4
|
-
let(:file) do
|
5
|
-
File.new(File.expand_path('../../../fixtures/image with spaces.png', __FILE__))
|
6
|
-
end
|
7
|
-
let(:attachment) do
|
8
|
-
build_stubbed(:alchemy_attachment, file: file, name: 'an image', file_name: 'image with spaces.png')
|
9
|
-
end
|
10
|
-
let(:essence) { Alchemy::EssenceFile.new(attachment: attachment) }
|
11
|
-
let(:content) { Alchemy::Content.new(essence: essence) }
|
12
|
-
|
13
|
-
context 'without attachment' do
|
14
|
-
let(:essence) { Alchemy::EssenceFile.new(attachment: nil) }
|
15
|
-
|
16
|
-
it "renders nothing" do
|
17
|
-
render content, content: content
|
18
|
-
expect(rendered).to eq('')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'with attachment' do
|
23
|
-
it "renders a link to download the attachment" do
|
24
|
-
render content, content: content
|
25
|
-
expect(rendered).to have_selector(
|
26
|
-
"a[href='/attachment/#{attachment.id}/download/#{attachment.urlname}.#{attachment.suffix}']"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with no link_text set' do
|
31
|
-
it "has this attachments name as link text" do
|
32
|
-
render content, content: content
|
33
|
-
expect(rendered).to have_selector("a:contains('#{attachment.name}')")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with link_text set in the local options' do
|
38
|
-
it "has this value as link text" do
|
39
|
-
render content, content: content, options: {link_text: 'Download this file'}
|
40
|
-
expect(rendered).to have_selector("a:contains('Download this file')")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with link_text set in the content settings' do
|
45
|
-
before do
|
46
|
-
allow(content).to receive(:settings) { {link_text: 'Download this file'} }
|
47
|
-
end
|
48
|
-
|
49
|
-
it "has this value as link text" do
|
50
|
-
render content, content: content
|
51
|
-
expect(rendered).to have_selector("a:contains('Download this file')")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'with link_text stored in the essence attribute' do
|
56
|
-
before do
|
57
|
-
allow(essence).to receive(:link_text) { 'Download this file' }
|
58
|
-
end
|
59
|
-
|
60
|
-
it "has this value as link text" do
|
61
|
-
render content, content: content
|
62
|
-
expect(rendered).to have_selector("a:contains('Download this file')")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context "with css_class set" do
|
68
|
-
before do
|
69
|
-
allow(essence).to receive(:css_class) { 'file-download' }
|
70
|
-
end
|
71
|
-
|
72
|
-
it "has this class at the link" do
|
73
|
-
render content, content: content
|
74
|
-
expect(rendered).to have_selector("a.file-download")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_html_view' do
|
4
|
-
let(:essence) { Alchemy::EssenceHtml.new(source: '<script>alert("hacked");</script>') }
|
5
|
-
let(:content) { Alchemy::Content.new(essence: essence) }
|
6
|
-
|
7
|
-
context 'without value' do
|
8
|
-
let(:essence) { Alchemy::EssenceHtml.new(source: nil) }
|
9
|
-
|
10
|
-
it "renders nothing" do
|
11
|
-
render content, content: content
|
12
|
-
expect(rendered).to eq('')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'with value' do
|
17
|
-
it "renders the raw html source" do
|
18
|
-
render content, content: content
|
19
|
-
expect(rendered).to have_selector("script")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'alchemy/essences/_essence_link_view' do
|
4
|
-
let(:essence) { Alchemy::EssenceLink.new(link: 'http://google.com') }
|
5
|
-
let(:content) { Alchemy::Content.new(essence: essence) }
|
6
|
-
let(:options) { {} }
|
7
|
-
|
8
|
-
context 'without value' do
|
9
|
-
let(:essence) { Alchemy::EssenceLink.new(link: nil) }
|
10
|
-
|
11
|
-
it "renders nothing" do
|
12
|
-
render content, content: content, options: options, html_options: {}
|
13
|
-
expect(rendered).to eq('')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "renders a link" do
|
18
|
-
render content, content: content, options: options, html_options: {}
|
19
|
-
expect(rendered).to eq('<a href="http://google.com">http://google.com</a>')
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'with text option' do
|
23
|
-
let(:options) { {text: 'Google'} }
|
24
|
-
|
25
|
-
it "renders a link" do
|
26
|
-
render content, content: content, options: options, html_options: {}
|
27
|
-
expect(rendered).to eq('<a href="http://google.com">Google</a>')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'with text setting on content definition' 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
|
41
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "essences/_essence_picture_editor" do
|
4
|
-
let(:picture) { stub_model(Alchemy::Picture) }
|
5
|
-
|
6
|
-
let(:essence_picture) do
|
7
|
-
stub_model(
|
8
|
-
Alchemy::EssencePicture,
|
9
|
-
picture: picture,
|
10
|
-
caption: 'This is a cute cat'
|
11
|
-
)
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:content) do
|
15
|
-
stub_model(
|
16
|
-
Alchemy::Content,
|
17
|
-
name: 'image',
|
18
|
-
essence_type: 'EssencePicture',
|
19
|
-
essence: essence_picture
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:options) { Hash.new }
|
24
|
-
|
25
|
-
before do
|
26
|
-
view.class.send(:include, Alchemy::Admin::BaseHelper)
|
27
|
-
view.class.send(:include, Alchemy::Admin::EssencesHelper)
|
28
|
-
allow(view).to receive(:content_label).and_return('')
|
29
|
-
allow(view).to receive(:essence_picture_thumbnail).and_return('')
|
30
|
-
end
|
31
|
-
|
32
|
-
subject do
|
33
|
-
render partial: "alchemy/essences/essence_picture_editor",
|
34
|
-
locals: {content: content, options: options}
|
35
|
-
rendered
|
36
|
-
end
|
37
|
-
|
38
|
-
context "with settings[:deletable] being nil" do
|
39
|
-
it 'should not render a button to link and unlink the picture' do
|
40
|
-
is_expected.to have_selector("a .icon.link")
|
41
|
-
is_expected.to have_selector("a .icon.unlink")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "with settings[:deletable] being false" do
|
46
|
-
let(:options) do
|
47
|
-
{linkable: false}
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should not render a button to link and unlink the picture' do
|
51
|
-
is_expected.to_not have_selector("a .icon.link")
|
52
|
-
is_expected.to_not have_selector("a .icon.unlink")
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'but renders the disabled link and unlink icons' do
|
56
|
-
is_expected.to have_selector(".icon.link")
|
57
|
-
is_expected.to have_selector(".icon.unlink")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'with allow_image_cropping? true' do
|
62
|
-
before do
|
63
|
-
allow(essence_picture).to receive(:allow_image_cropping?) { true }
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'shows cropping link' do
|
67
|
-
is_expected.to have_selector('a[href*="crop"]')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'with allow_image_cropping? false' do
|
72
|
-
before do
|
73
|
-
allow(essence_picture).to receive(:allow_image_cropping?) { false }
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'shows disabled cropping link' do
|
77
|
-
is_expected.to have_selector('a.disabled .icon.crop')
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,128 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "essences/_essence_picture_view" do
|
4
|
-
let(:essence_picture) { stub_model(Alchemy::EssencePicture, picture: stub_model(Alchemy::Picture), caption: 'This is a cute cat') }
|
5
|
-
let(:content) { stub_model(Alchemy::Content, name: 'image', essence_type: 'EssencePicture', essence: essence_picture) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
ActionView::Base.send(:include, Alchemy::UrlHelper)
|
9
|
-
ActionView::Base.send(:include, Alchemy::EssencesHelper)
|
10
|
-
allow(view).to receive(:configuration).and_return(:jpg)
|
11
|
-
end
|
12
|
-
|
13
|
-
context "with caption" do
|
14
|
-
let(:options) { {} }
|
15
|
-
let(:html_options) { {} }
|
16
|
-
|
17
|
-
subject do
|
18
|
-
render partial: "alchemy/essences/essence_picture_view", locals: {
|
19
|
-
content: content,
|
20
|
-
options: options,
|
21
|
-
html_options: html_options
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should enclose the image in a <figure> element" do
|
26
|
-
is_expected.to have_selector('figure img')
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should shows the caption" do
|
30
|
-
should have_selector('figure figcaption')
|
31
|
-
should have_content('This is a cute cat')
|
32
|
-
end
|
33
|
-
|
34
|
-
context "but disabled in the options" do
|
35
|
-
let(:options) { {show_caption: false} }
|
36
|
-
|
37
|
-
it "should not enclose the image in a <figure> element" do
|
38
|
-
should_not have_selector('figure img')
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should not show the caption" do
|
42
|
-
should_not have_selector('figure figcaption')
|
43
|
-
should_not have_content('This is a cute cat')
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "but disabled in the content settings" do
|
48
|
-
before do
|
49
|
-
allow(content).to receive(:settings).and_return({show_caption: false})
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should not enclose the image in a <figure> element" do
|
53
|
-
should_not have_selector('figure img')
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should not show the caption" do
|
57
|
-
should_not have_selector('figure figcaption')
|
58
|
-
should_not have_content('This is a cute cat')
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'but enabled in the options hash' do
|
62
|
-
let(:options) { {show_caption: true} }
|
63
|
-
|
64
|
-
it "should enclose the image in a <figure> element" do
|
65
|
-
should have_selector('figure img')
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should shows the caption" do
|
69
|
-
should have_selector('figure figcaption')
|
70
|
-
should have_content('This is a cute cat')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context "and essence with css class" do
|
76
|
-
before { essence_picture.css_class = 'left' }
|
77
|
-
|
78
|
-
it "should have the class on the <figure> element" do
|
79
|
-
is_expected.to have_selector('figure.left img')
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should not have the class on the <img> element" do
|
83
|
-
is_expected.not_to have_selector('figure img.left')
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
context "and css class in the html_options" do
|
88
|
-
before { html_options[:class] = 'right' }
|
89
|
-
|
90
|
-
it "should have the class from the html_options on the <figure> element" do
|
91
|
-
is_expected.to have_selector('figure.right img')
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should not have the class from the essence on the <figure> element" do
|
95
|
-
is_expected.not_to have_selector('figure.left img')
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should not have the class from the html_options on the <img> element" do
|
99
|
-
is_expected.not_to have_selector('figure img.right')
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
context "with link" do
|
105
|
-
let(:options) { {} }
|
106
|
-
|
107
|
-
subject do
|
108
|
-
essence_picture.link = '/home'
|
109
|
-
render partial: "alchemy/essences/essence_picture_view", locals: {
|
110
|
-
content: content,
|
111
|
-
options: options,
|
112
|
-
html_options: {}
|
113
|
-
}
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should enclose the image in a link tag" do
|
117
|
-
is_expected.to have_selector('a[href="/home"] img')
|
118
|
-
end
|
119
|
-
|
120
|
-
context "but disabled link option" do
|
121
|
-
before { options[:disable_link] = true }
|
122
|
-
|
123
|
-
it "should not enclose the image in a link tag" do
|
124
|
-
is_expected.not_to have_selector('a img')
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|