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,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Site select' do
|
4
|
-
before do
|
5
|
-
authorize_user(:as_admin)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "does not display the site change" do
|
9
|
-
visit admin_dashboard_path
|
10
|
-
expect(page).not_to have_select('change_site')
|
11
|
-
end
|
12
|
-
|
13
|
-
context "multiple sites" do
|
14
|
-
let!(:a_site) { create(:alchemy_site) }
|
15
|
-
|
16
|
-
it "contains all sites in a selectbox" do
|
17
|
-
visit admin_dashboard_path
|
18
|
-
expect(page).to have_select('change_site', options: [Alchemy::Site.default.name, a_site.name], selected: Alchemy::Site.default.name)
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when requesting non-default site' do
|
22
|
-
it "provides the correct site" do
|
23
|
-
visit admin_pages_path(site_id: a_site.id)
|
24
|
-
expect(page).to have_select('change_site', selected: a_site.name)
|
25
|
-
|
26
|
-
visit admin_dashboard_path
|
27
|
-
expect(page).to have_select('change_site', selected: a_site.name)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'TinyMCE Editor' do
|
4
|
-
before do
|
5
|
-
authorize_user(:as_admin)
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'base path should be set to tinymce asset folder' do
|
9
|
-
visit admin_dashboard_path
|
10
|
-
expect(page).to have_content <<-TINYMCE
|
11
|
-
var tinyMCEPreInit = {
|
12
|
-
base: '/assets/tinymce',
|
13
|
-
suffix: '.min'
|
14
|
-
};
|
15
|
-
TINYMCE
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'with asset host' do
|
19
|
-
before do
|
20
|
-
expect(ActionController::Base.config).to receive(:asset_host_set?).and_return(true)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'base path should be set to tinymce asset folder' do
|
24
|
-
visit admin_dashboard_path
|
25
|
-
expect(page).to have_content <<-TINYMCE
|
26
|
-
var tinyMCEPreInit = {
|
27
|
-
base: 'http://www.example.com/assets/tinymce',
|
28
|
-
suffix: '.min'
|
29
|
-
};
|
30
|
-
TINYMCE
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,186 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe 'Show page feature:' do
|
5
|
-
let!(:default_language) { Language.default }
|
6
|
-
|
7
|
-
let!(:default_language_root) do
|
8
|
-
create(:alchemy_page, :language_root, language: default_language, name: 'Home')
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:public_page) do
|
12
|
-
create(:alchemy_page, :public, visible: true, name: 'Page 1')
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:public_child) do
|
16
|
-
create(:alchemy_page, :public, name: 'Public Child', parent_id: public_page.id)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "When no page is present" do
|
20
|
-
before do
|
21
|
-
Alchemy::Page.delete_all
|
22
|
-
end
|
23
|
-
|
24
|
-
context "and no admin user is present yet" do
|
25
|
-
before do
|
26
|
-
Alchemy.user_class.delete_all
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'shows a welcome page' do
|
30
|
-
visit "/"
|
31
|
-
expect(page).to have_content('Welcome to Alchemy')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'rendered' do
|
37
|
-
let(:public_page) { create(:alchemy_page, :public, do_not_autogenerate: false) }
|
38
|
-
let(:article) { public_page.elements.find_by_name('article') }
|
39
|
-
let(:essence) { article.content_by_name('intro').essence }
|
40
|
-
|
41
|
-
before do
|
42
|
-
essence.update_attributes(body: 'Welcome to Peters Petshop', public: true)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should include all its elements and contents" do
|
46
|
-
visit "/#{public_page.urlname}"
|
47
|
-
within('div#content div.article div.intro') do
|
48
|
-
expect(page).to have_content('Welcome to Peters Petshop')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should show the navigation with all visible pages" do
|
54
|
-
create(:alchemy_page, :public, visible: true, name: 'Page 1')
|
55
|
-
create(:alchemy_page, :public, visible: true, name: 'Page 2')
|
56
|
-
visit '/'
|
57
|
-
within('div#navigation ul') do
|
58
|
-
expect(page).to have_selector('li a[href="/page-1"], li a[href="/page-2"]')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "Handling of non-existing pages" do
|
63
|
-
before do
|
64
|
-
# We need a admin user or the signup page will show up
|
65
|
-
allow(Alchemy.user_class).to receive(:admins).and_return([1, 2])
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should render public/404.html" do
|
69
|
-
expect {
|
70
|
-
visit "/non-existing-page"
|
71
|
-
}.to raise_error(ActionController::RoutingError)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context "with invalid byte code char in urlname parameter" do
|
76
|
-
it "should raise BadRequest (400) error" do
|
77
|
-
expect { visit '/%ed' }.to raise_error(ActionController::BadRequest)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe "menubar" do
|
82
|
-
context "rendering for guest users" do
|
83
|
-
it "is prohibited" do
|
84
|
-
visit "/#{public_page.urlname}"
|
85
|
-
within('body') { expect(page).not_to have_selector('#alchemy_menubar') }
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "rendering for members" do
|
90
|
-
it "is prohibited" do
|
91
|
-
authorize_user(build(:alchemy_dummy_user))
|
92
|
-
visit "/#{public_page.urlname}"
|
93
|
-
within('body') { expect(page).not_to have_selector('#alchemy_menubar') }
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context "rendering for authors" do
|
98
|
-
it "is allowed" do
|
99
|
-
authorize_user(:as_author)
|
100
|
-
visit "/#{public_page.urlname}"
|
101
|
-
within('body') { expect(page).to have_selector('#alchemy_menubar') }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context "rendering for editors" do
|
106
|
-
it "is allowed" do
|
107
|
-
authorize_user(:as_editor)
|
108
|
-
visit "/#{public_page.urlname}"
|
109
|
-
within('body') { expect(page).to have_selector('#alchemy_menubar') }
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context "rendering for admins" do
|
114
|
-
it "is allowed" do
|
115
|
-
authorize_user(:as_admin)
|
116
|
-
visit "/#{public_page.urlname}"
|
117
|
-
within('body') { expect(page).to have_selector('#alchemy_menubar') }
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "contains" do
|
122
|
-
before do
|
123
|
-
authorize_user(:as_admin)
|
124
|
-
visit "/#{public_page.urlname}"
|
125
|
-
end
|
126
|
-
|
127
|
-
it "a link to the admin area" do
|
128
|
-
within('#alchemy_menubar') do
|
129
|
-
expect(page).to have_selector("li a[href='#{alchemy.admin_dashboard_url}']")
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
it "a link to edit the current page" do
|
134
|
-
within('#alchemy_menubar') do
|
135
|
-
expect(page).to \
|
136
|
-
have_selector("li a[href='#{alchemy.edit_admin_page_url(public_page)}']")
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
it "a form and button to logout of alchemy" do
|
141
|
-
within('#alchemy_menubar') do
|
142
|
-
expect(page).to \
|
143
|
-
have_selector("li form[action='#{Alchemy.logout_path}'], li button[type='submit']")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe 'navigation rendering' do
|
150
|
-
context 'with page having an external url without protocol' do
|
151
|
-
let!(:external_page) do
|
152
|
-
create(:alchemy_page, urlname: 'google.com', page_layout: 'external', visible: true)
|
153
|
-
end
|
154
|
-
|
155
|
-
it "adds an prefix to url" do
|
156
|
-
visit "/#{public_page.urlname}"
|
157
|
-
within '#navigation' do
|
158
|
-
expect(page.body).to match('http://google.com')
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe 'accessing restricted pages' do
|
165
|
-
let!(:restricted_page) { create(:alchemy_page, :restricted, public: true) }
|
166
|
-
|
167
|
-
context 'as a guest user' do
|
168
|
-
it "I am not able to visit the page" do
|
169
|
-
visit restricted_page.urlname
|
170
|
-
expect(current_path).to eq(Alchemy.login_path)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
context 'as a member user' do
|
175
|
-
before do
|
176
|
-
authorize_user(create(:alchemy_dummy_user))
|
177
|
-
end
|
178
|
-
|
179
|
-
it "I am able to visit the page" do
|
180
|
-
visit restricted_page.urlname
|
181
|
-
expect(current_path).to eq("/#{restricted_page.urlname}")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
@@ -1,358 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe 'Requesting a page' do
|
5
|
-
let!(:default_language) { Language.default }
|
6
|
-
|
7
|
-
let!(:default_language_root) do
|
8
|
-
create(:alchemy_page, :language_root, language: default_language, name: 'Home')
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:public_page) do
|
12
|
-
create(:alchemy_page, :public, visible: true, name: 'Page 1')
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:public_child) do
|
16
|
-
create(:alchemy_page, :public, name: 'Public Child', parent_id: public_page.id)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "in multi language mode" do
|
20
|
-
let(:second_page) { create(:alchemy_page, :public, name: 'Second Page') }
|
21
|
-
|
22
|
-
let(:legacy_url) do
|
23
|
-
LegacyPageUrl.create(
|
24
|
-
urlname: 'index.php?option=com_content&view=article&id=48&Itemid=69',
|
25
|
-
page: second_page
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
before do
|
30
|
-
allow_any_instance_of(PagesController).to receive(:multi_language?).and_return(true)
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'if language params are given' do
|
34
|
-
context "and page locale is default locale" do
|
35
|
-
it "redirects to unprefixed locale url" do
|
36
|
-
allow(::I18n).to receive(:default_locale) { public_page.language_code.to_sym }
|
37
|
-
visit("/#{public_page.language_code}/#{public_page.urlname}")
|
38
|
-
expect(page.current_path).to eq("/#{public_page.urlname}")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "and page locale is not default locale" do
|
43
|
-
it "does not redirect" do
|
44
|
-
allow(::I18n).to receive(:default_locale).and_return(:de)
|
45
|
-
visit("/#{public_page.language_code}/#{public_page.urlname}")
|
46
|
-
expect(page.current_path).to eq("/#{public_page.language_code}/#{public_page.urlname}")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'if no language params are given' do
|
52
|
-
context "and page locale is default locale" do
|
53
|
-
it "doesn't prepend the url with the locale string" do
|
54
|
-
allow(::I18n).to receive(:default_locale) { public_page.language_code.to_sym }
|
55
|
-
visit("/#{public_page.urlname}")
|
56
|
-
expect(page.current_path).to eq("/#{public_page.urlname}")
|
57
|
-
end
|
58
|
-
|
59
|
-
it "redirects legacy url with unknown format & query string without locale prefix" do
|
60
|
-
allow(::I18n).to receive(:default_locale) { second_page.language_code.to_sym }
|
61
|
-
visit "/#{legacy_url.urlname}"
|
62
|
-
uri = URI.parse(page.current_url)
|
63
|
-
expect(uri.query).to be_nil
|
64
|
-
expect(uri.request_uri).to eq("/#{second_page.urlname}")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "and page locale is not default locale" do
|
69
|
-
before do
|
70
|
-
allow(::I18n).to receive(:default_locale).and_return(:de)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "redirects to url with the locale prefixed" do
|
74
|
-
visit("/#{public_page.urlname}")
|
75
|
-
expect(page.current_path).to eq("/en/#{public_page.urlname}")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "redirects legacy url with unknown format & query string with locale prefix" do
|
79
|
-
visit "/#{legacy_url.urlname}"
|
80
|
-
uri = URI.parse(page.current_url)
|
81
|
-
expect(uri.query).to be_nil
|
82
|
-
expect(uri.request_uri).to eq("/en/#{second_page.urlname}")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
context "if requested page is unpublished" do
|
88
|
-
before do
|
89
|
-
public_page.update_attributes(
|
90
|
-
public: false,
|
91
|
-
visible: false,
|
92
|
-
name: 'Not Public',
|
93
|
-
urlname: ''
|
94
|
-
)
|
95
|
-
public_child
|
96
|
-
end
|
97
|
-
|
98
|
-
it "redirects to public child" do
|
99
|
-
visit "/not-public"
|
100
|
-
expect(page.current_path).to eq("/public-child")
|
101
|
-
end
|
102
|
-
|
103
|
-
context "with only unpublished pages in page tree" do
|
104
|
-
before do
|
105
|
-
public_child.update_attributes(public: false)
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should raise not found error" do
|
109
|
-
expect {
|
110
|
-
visit "/not-public"
|
111
|
-
}.to raise_error(ActionController::RoutingError)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context "if page locale is the default locale" do
|
116
|
-
it "redirects to public child with prefixed locale" do
|
117
|
-
allow(::I18n).to receive(:default_locale).and_return(:de)
|
118
|
-
visit "/not-public"
|
119
|
-
expect(page.current_path).to eq("/en/public-child")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context "if requested url is the index url" do
|
125
|
-
context 'and redirect_index is set to true' do
|
126
|
-
before do
|
127
|
-
allow(Config).to receive(:get) do |arg|
|
128
|
-
arg == :redirect_index ? true : Config.parameter(arg)
|
129
|
-
end
|
130
|
-
if Alchemy.version == "4.0.0.rc1"
|
131
|
-
raise "Remove deprecated `redirect_index` configuration!"
|
132
|
-
end
|
133
|
-
ActiveSupport::Deprecation.silenced = true
|
134
|
-
end
|
135
|
-
|
136
|
-
after do
|
137
|
-
ActiveSupport::Deprecation.silenced = false
|
138
|
-
end
|
139
|
-
|
140
|
-
context "and if page locale is the default locale" do
|
141
|
-
it "redirects to the default language root page without prefixed locale" do
|
142
|
-
visit '/'
|
143
|
-
expect(page.current_path).to eq('/home')
|
144
|
-
end
|
145
|
-
|
146
|
-
context "having additional parameter" do
|
147
|
-
it "redirects to the default language root page with prefixed locale while keeping the additional params" do
|
148
|
-
visit '/?search=kitten'
|
149
|
-
expect(page.current_url).to eq('http://www.example.com/home?search=kitten')
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
context "and if page locale is not the default locale" do
|
155
|
-
before do
|
156
|
-
allow(::I18n).to receive(:default_locale).and_return(:de)
|
157
|
-
end
|
158
|
-
|
159
|
-
it "redirects to the default language root page with prefixed locale" do
|
160
|
-
visit '/'
|
161
|
-
expect(page.current_path).to eq('/en/home')
|
162
|
-
end
|
163
|
-
|
164
|
-
context "having additional parameter" do
|
165
|
-
it "redirects to the default language root page with prefixed locale while keeping the additional params" do
|
166
|
-
visit '/?search=kitten'
|
167
|
-
expect(page.current_url).to eq('http://www.example.com/en/home?search=kitten')
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
context 'and redirect_index is set to false' do
|
174
|
-
before do
|
175
|
-
allow(Config).to receive(:get) do |arg|
|
176
|
-
arg == :redirect_index ? false : Config.parameter(arg)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
it "does not redirect" do
|
181
|
-
visit '/'
|
182
|
-
expect(page.current_path).to eq('/')
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context "if requested url is only the language code" do
|
188
|
-
context 'and redirect_index is set to true' do
|
189
|
-
before do
|
190
|
-
allow(Config).to receive(:get) do |arg|
|
191
|
-
arg == :redirect_index ? true : Config.parameter(arg)
|
192
|
-
end
|
193
|
-
if Alchemy.version == "4.0.0.rc1"
|
194
|
-
raise "Remove deprecated `redirect_index` configuration!"
|
195
|
-
end
|
196
|
-
ActiveSupport::Deprecation.silenced = true
|
197
|
-
end
|
198
|
-
|
199
|
-
after do
|
200
|
-
ActiveSupport::Deprecation.silenced = false
|
201
|
-
end
|
202
|
-
|
203
|
-
context "if page locale is the default locale" do
|
204
|
-
it "redirects to pages url without locale prefixed" do
|
205
|
-
visit "/#{default_language.code}"
|
206
|
-
expect(page.current_path).to eq("/home")
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
context "if page locale is not the default locale" do
|
211
|
-
it "redirects to the default language root url with prefixed locale" do
|
212
|
-
allow(::I18n).to receive(:default_locale).and_return(:de)
|
213
|
-
visit "/#{default_language.code}"
|
214
|
-
expect(page.current_path).to eq('/en/home')
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
context 'and redirect_index is set to false' do
|
220
|
-
before do
|
221
|
-
allow(Config).to receive(:get) do |arg|
|
222
|
-
arg == :redirect_index ? false : Config.parameter(arg)
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
context "if requested locale is the default locale" do
|
227
|
-
before do
|
228
|
-
allow(::I18n).to receive(:default_locale) { default_language.code }
|
229
|
-
end
|
230
|
-
|
231
|
-
it "redirects to '/'" do
|
232
|
-
visit "/#{default_language.code}"
|
233
|
-
expect(page.current_path).to eq('/')
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
context "if page locale is not the default locale" do
|
238
|
-
before do
|
239
|
-
allow(::I18n).to receive(:default_locale) { :de }
|
240
|
-
end
|
241
|
-
|
242
|
-
it "does not redirect" do
|
243
|
-
visit "/#{default_language.code}"
|
244
|
-
expect(page.current_path).to eq("/#{default_language.code}")
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
it "should keep additional params" do
|
251
|
-
visit "/#{public_page.urlname}?query=Peter"
|
252
|
-
expect(page.current_url).to match(/\?query=Peter/)
|
253
|
-
end
|
254
|
-
|
255
|
-
context "wrong language requested" do
|
256
|
-
before do
|
257
|
-
allow(Alchemy.user_class).to receive(:admins).and_return([1, 2])
|
258
|
-
end
|
259
|
-
|
260
|
-
it "should render 404 if urlname and lang parameter do not belong to same page" do
|
261
|
-
create(:alchemy_language, :klingon)
|
262
|
-
expect {
|
263
|
-
visit "/kl/#{public_page.urlname}"
|
264
|
-
}.to raise_error(ActionController::RoutingError)
|
265
|
-
end
|
266
|
-
|
267
|
-
it "should render 404 if requested language does not exist" do
|
268
|
-
public_page
|
269
|
-
LegacyPageUrl.delete_all
|
270
|
-
expect {
|
271
|
-
visit "/fo/#{public_page.urlname}"
|
272
|
-
}.to raise_error(ActionController::RoutingError)
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
context "not in multi language mode" do
|
278
|
-
let(:second_page) { create(:alchemy_page, :public, name: 'Second Page') }
|
279
|
-
|
280
|
-
let(:legacy_url) do
|
281
|
-
LegacyPageUrl.create(
|
282
|
-
urlname: 'index.php?option=com_content&view=article&id=48&Itemid=69',
|
283
|
-
page: second_page
|
284
|
-
)
|
285
|
-
end
|
286
|
-
|
287
|
-
before do
|
288
|
-
allow_any_instance_of(PagesController).to receive(:multi_language?).and_return(false)
|
289
|
-
end
|
290
|
-
|
291
|
-
it "redirects legacy url with unknown format & query string" do
|
292
|
-
visit "/#{legacy_url.urlname}"
|
293
|
-
uri = URI.parse(page.current_url)
|
294
|
-
expect(uri.query).to be_nil
|
295
|
-
expect(uri.request_uri).to eq("/#{second_page.urlname}")
|
296
|
-
end
|
297
|
-
|
298
|
-
it "redirects from nested language code url to normal url" do
|
299
|
-
visit "/en/#{public_page.urlname}"
|
300
|
-
expect(page.current_path).to eq("/#{public_page.urlname}")
|
301
|
-
end
|
302
|
-
|
303
|
-
context "redirects to public child" do
|
304
|
-
before do
|
305
|
-
public_page.update_attributes(
|
306
|
-
public: false,
|
307
|
-
visible: false,
|
308
|
-
name: 'Not Public',
|
309
|
-
urlname: ''
|
310
|
-
)
|
311
|
-
public_child
|
312
|
-
end
|
313
|
-
|
314
|
-
it "if requested page is unpublished" do
|
315
|
-
visit '/not-public'
|
316
|
-
expect(page.current_path).to eq('/public-child')
|
317
|
-
end
|
318
|
-
|
319
|
-
it "with normal url, if requested url has nested language code and is not public" do
|
320
|
-
visit '/en/not-public'
|
321
|
-
expect(page.current_path).to eq('/public-child')
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
context 'if requested url is index url' do
|
326
|
-
context "when locale is prefixed" do
|
327
|
-
it "redirects to normal url" do
|
328
|
-
visit "/en"
|
329
|
-
expect(page.current_path).to eq("/")
|
330
|
-
end
|
331
|
-
end
|
332
|
-
|
333
|
-
context "when redirect_index is enabled" do
|
334
|
-
before do
|
335
|
-
allow(Config).to receive(:get) do |arg|
|
336
|
-
arg == :redirect_index ? true : Config.parameter(arg)
|
337
|
-
end
|
338
|
-
if Alchemy.version == "4.0.0.rc1"
|
339
|
-
raise "Remove deprecated `redirect_index` configuration!"
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
it "redirects to pages url" do
|
344
|
-
ActiveSupport::Deprecation.silence do
|
345
|
-
visit '/'
|
346
|
-
expect(page.current_path).to eq('/home')
|
347
|
-
end
|
348
|
-
end
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
it "should keep additional params" do
|
353
|
-
visit "/en/#{public_page.urlname}?query=Peter"
|
354
|
-
expect(page.current_url).to match(/\?query=Peter/)
|
355
|
-
end
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|