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