alchemy_cms 3.3.0.rc1 → 3.3.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +0,0 @@
|
|
|
1
|
-
var TestResponses = {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# path to parent directory of src_files
|
|
2
|
-
# relative path from Rails.root
|
|
3
|
-
# defaults to app/assets/javascripts
|
|
4
|
-
src_dir: "app/assets/javascripts"
|
|
5
|
-
|
|
6
|
-
# list of file expressions to include as source files
|
|
7
|
-
# relative path from src_dir
|
|
8
|
-
src_files:
|
|
9
|
-
- "application.{js,coffee}"
|
|
10
|
-
|
|
11
|
-
# path to parent directory of spec_files
|
|
12
|
-
# relative path from Rails.root
|
|
13
|
-
# defaults to spec/javascripts
|
|
14
|
-
spec_dir: spec/javascripts
|
|
15
|
-
|
|
16
|
-
# list of file expressions to include as helpers into spec runner
|
|
17
|
-
# relative path from spec_dir
|
|
18
|
-
helpers:
|
|
19
|
-
- "helpers/**/*.{js,coffee}"
|
|
20
|
-
|
|
21
|
-
# list of file expressions to include as specs into spec runner
|
|
22
|
-
# relative path from spec_dir
|
|
23
|
-
spec_files:
|
|
24
|
-
- "**/*[Ss]pec.{js,coffee}"
|
|
25
|
-
|
|
26
|
-
# path to directory of temporary files
|
|
27
|
-
# (spec runner and asset cache)
|
|
28
|
-
# defaults to spec/tmp
|
|
29
|
-
tmp_dir: "spec/tmp"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
class MyCustomUser
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
describe 'AuthAccessors' do
|
|
8
|
-
describe '.user_class' do
|
|
9
|
-
before do
|
|
10
|
-
# prevent memoization
|
|
11
|
-
Alchemy.class_variable_set('@@user_class', nil)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "raises error if user_class_name is not a String" do
|
|
15
|
-
Alchemy.user_class_name = MyCustomUser
|
|
16
|
-
expect {
|
|
17
|
-
Alchemy.user_class
|
|
18
|
-
}.to raise_error(TypeError)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
after do
|
|
22
|
-
Alchemy.user_class_name = 'DummyUser'
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe 'defaults' do
|
|
27
|
-
it 'has default value for Alchemy.signup_path' do
|
|
28
|
-
expect(Alchemy.signup_path).to eq('/signup')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'has default value for Alchemy.login_path' do
|
|
32
|
-
expect(Alchemy.login_path).to eq('/login')
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'has default value for Alchemy.logout_path' do
|
|
36
|
-
expect(Alchemy.logout_path).to eq('/logout')
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
describe Config do
|
|
5
|
-
describe ".get" do
|
|
6
|
-
it "should call #show" do
|
|
7
|
-
expect(Config).to receive(:show).and_return({})
|
|
8
|
-
Config.get(:mailer)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should return the requested part of the config" do
|
|
12
|
-
expect(Config).to receive(:show).and_return({'mailer' => {'setting' => 'true'}})
|
|
13
|
-
expect(Config.get(:mailer)).to eq({'setting' => 'true'})
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe '.main_app_config' do
|
|
18
|
-
let(:main_app_config_path) { "#{Rails.root}/config/alchemy/config.yml" }
|
|
19
|
-
|
|
20
|
-
it "should call and return .read_file with the correct config path" do
|
|
21
|
-
expect(Config).to receive(:read_file).with(main_app_config_path).once.and_return({setting: 'true'})
|
|
22
|
-
expect(Config.send(:main_app_config)).to eq({setting: 'true'})
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe '.env_specific_config' do
|
|
27
|
-
let(:env_specific_config_path) { "#{Rails.root}/config/alchemy/#{Rails.env}.config.yml" }
|
|
28
|
-
|
|
29
|
-
it "should call and return .read_file with the correct config path" do
|
|
30
|
-
expect(Config).to receive(:read_file).with(env_specific_config_path).once.and_return({setting: 'true'})
|
|
31
|
-
expect(Config.send(:env_specific_config)).to eq({setting: 'true'})
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe ".show" do
|
|
36
|
-
context "when ivar @config was not set before" do
|
|
37
|
-
before { Config.instance_variable_set("@config", nil) }
|
|
38
|
-
|
|
39
|
-
it "should call and return .merge_configs!" do
|
|
40
|
-
expect(Config).to receive(:merge_configs!).once.and_return({setting: 'true'})
|
|
41
|
-
expect(Config.show).to eq({setting: 'true'})
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
context "when ivar @config was already set" do
|
|
46
|
-
before { Config.instance_variable_set("@config", {setting: 'true'}) }
|
|
47
|
-
after { Config.instance_variable_set("@config", nil) }
|
|
48
|
-
|
|
49
|
-
it "should have memoized the return value of .merge_configs!" do
|
|
50
|
-
expect(Config.send(:show)).to eq({setting: 'true'})
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe '.read_file' do
|
|
56
|
-
context 'when given path to yml file exists' do
|
|
57
|
-
before { allow(File).to receive(:exist?).and_return(true) }
|
|
58
|
-
|
|
59
|
-
it 'should call YAML.load_file with the given config path' do
|
|
60
|
-
expect(YAML).to receive(:load_file).once.with('path/to/config.yml').and_return({})
|
|
61
|
-
Config.send(:read_file, 'path/to/config.yml')
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
context 'but its empty' do
|
|
65
|
-
before do
|
|
66
|
-
allow(File).to receive(:exist?).with('empty_file.yml').and_return(true)
|
|
67
|
-
allow(YAML).to receive(:load_file).and_return(false) # YAML.load_file returns false if file is empty.
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "should return an empty Hash" do
|
|
71
|
-
expect(Config.send(:read_file, 'empty_file.yml')).to eq({})
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context 'when given path to yml file does not exist' do
|
|
77
|
-
it 'should return an empty Hash' do
|
|
78
|
-
expect(Config.send(:read_file, 'does/not/exist.yml')).to eq({})
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe '.merge_configs!' do
|
|
84
|
-
let(:config_1) do
|
|
85
|
-
{setting_1: 'same', other_setting: 'something'}
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
let(:config_2) do
|
|
89
|
-
{setting_1: 'same', setting_2: 'anything'}
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "should stringify the keys" do
|
|
93
|
-
expect(Config.send(:merge_configs!, config_1)).to eq(config_1.stringify_keys!)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
context 'when all passed configs are empty' do
|
|
97
|
-
it "should raise an error" do
|
|
98
|
-
expect { Config.send(:merge_configs!, {}) }.to raise_error(LoadError)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
context 'when configs containing same keys' do
|
|
103
|
-
it "should merge them together" do
|
|
104
|
-
expect(Config.send(:merge_configs!, config_1, config_2)).to eq(
|
|
105
|
-
{'setting_1' => 'same', 'other_setting' => 'something', 'setting_2' => 'anything'}
|
|
106
|
-
)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
# Here's a tiny custom matcher making it a bit easier to check the
|
|
4
|
-
# current session for a language configuration.
|
|
5
|
-
#
|
|
6
|
-
RSpec::Matchers.define :include_language_information_for do |expected|
|
|
7
|
-
match do |actual|
|
|
8
|
-
actual[:alchemy_language_id] == expected.id
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'Alchemy::ControllerActions', type: 'controller' do
|
|
13
|
-
# Anonymous controller to test the integration against
|
|
14
|
-
controller(ActionController::Base) do
|
|
15
|
-
include Alchemy::ControllerActions
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe "#current_alchemy_user" do
|
|
19
|
-
context "with default current_user_method" do
|
|
20
|
-
it "calls current_user by default" do
|
|
21
|
-
expect(controller).to receive :current_user
|
|
22
|
-
controller.send :current_alchemy_user
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context "with custom current_user_method" do
|
|
27
|
-
before do
|
|
28
|
-
Alchemy.current_user_method = 'current_admin'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "calls the custom method" do
|
|
32
|
-
expect(controller).to receive :current_admin
|
|
33
|
-
controller.send :current_alchemy_user
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context "with not implemented current_user_method" do
|
|
38
|
-
before do
|
|
39
|
-
Alchemy.current_user_method = 'not_implemented_method'
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
after do
|
|
43
|
-
Alchemy.current_user_method = 'current_user'
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "raises an error" do
|
|
47
|
-
expect{
|
|
48
|
-
controller.send :current_alchemy_user
|
|
49
|
-
}.to raise_error(Alchemy::NoCurrentUserFoundError)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe "#set_alchemy_language" do
|
|
55
|
-
let(:default_language) { Alchemy::Language.default }
|
|
56
|
-
let(:klingon) { create(:alchemy_language, :klingon) }
|
|
57
|
-
|
|
58
|
-
after do
|
|
59
|
-
# We must never change the app's locale
|
|
60
|
-
expect(::I18n.locale).to eq(:en)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
context "with a Language argument" do
|
|
64
|
-
it "should set the language to the passed Language instance" do
|
|
65
|
-
controller.send :set_alchemy_language, klingon
|
|
66
|
-
expect(assigns(:language)).to eq(klingon)
|
|
67
|
-
expect(Alchemy::Language.current).to eq(klingon)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
context "with a language id argument" do
|
|
72
|
-
it "should set the language to the language specified by the passed id" do
|
|
73
|
-
controller.send :set_alchemy_language, klingon.id
|
|
74
|
-
expect(assigns(:language)).to eq(klingon)
|
|
75
|
-
expect(Alchemy::Language.current).to eq(klingon)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
context "with a language code argument" do
|
|
80
|
-
it "should set the language to the language specified by the passed code" do
|
|
81
|
-
controller.send :set_alchemy_language, klingon.code
|
|
82
|
-
expect(assigns(:language)).to eq(klingon)
|
|
83
|
-
expect(Alchemy::Language.current).to eq(klingon)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
context "with no lang param" do
|
|
88
|
-
it "should set the default language" do
|
|
89
|
-
allow(controller).to receive(:params).and_return({})
|
|
90
|
-
controller.send :set_alchemy_language
|
|
91
|
-
expect(assigns(:language)).to eq(default_language)
|
|
92
|
-
expect(Alchemy::Language.current).to eq(default_language)
|
|
93
|
-
expect(controller.session).to include_language_information_for(default_language)
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
context "with language in the session" do
|
|
98
|
-
before do
|
|
99
|
-
allow(controller).to receive(:session).and_return(alchemy_language_id: klingon.id)
|
|
100
|
-
allow(Alchemy::Language).to receive(:current).and_return(klingon)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it "should use the language from the session" do
|
|
104
|
-
controller.send :set_alchemy_language
|
|
105
|
-
expect(assigns(:language)).to eq(klingon)
|
|
106
|
-
expect(Alchemy::Language.current).to eq(klingon)
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
context "with lang param" do
|
|
111
|
-
it "should set the language" do
|
|
112
|
-
allow(controller).to receive(:params).and_return(locale: klingon.code)
|
|
113
|
-
controller.send :set_alchemy_language
|
|
114
|
-
expect(assigns(:language)).to eq(klingon)
|
|
115
|
-
expect(Alchemy::Language.current).to eq(klingon)
|
|
116
|
-
expect(controller.session).to include_language_information_for(klingon)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
context "for language that does not exist" do
|
|
120
|
-
before do
|
|
121
|
-
allow(controller).to receive(:params).and_return(locale: 'fo')
|
|
122
|
-
controller.send :set_alchemy_language
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "should set the language to default" do
|
|
126
|
-
expect(assigns(:language)).to eq(default_language)
|
|
127
|
-
expect(Alchemy::Language.current).to eq(default_language)
|
|
128
|
-
expect(controller.session).to include_language_information_for(default_language)
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
data/spec/libraries/i18n_spec.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
describe ".t" do
|
|
5
|
-
it 'scopes translations intro alchemy namespace' do
|
|
6
|
-
expect(::I18n).to receive(:t).with(:foo, default: 'Foo', scope: ['alchemy'])
|
|
7
|
-
::Alchemy.t(:foo)
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
describe I18n do
|
|
12
|
-
describe '.translation_files' do
|
|
13
|
-
subject { I18n.translation_files }
|
|
14
|
-
it { is_expected.to be_a Array }
|
|
15
|
-
it { is_expected.to be_any { |f| f =~ /alchemy.*.yml/ } }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe '.available_locales' do
|
|
19
|
-
subject { I18n.available_locales }
|
|
20
|
-
before { allow(I18n).to receive(:translation_files).and_return(['alchemy.kl.yml']) }
|
|
21
|
-
it { is_expected.to be_a Array }
|
|
22
|
-
it { is_expected.to include :kl }
|
|
23
|
-
|
|
24
|
-
context 'when locales are already set in @@available_locales' do
|
|
25
|
-
before { I18n.class_variable_set(:@@available_locales, [:kl, :jp]) }
|
|
26
|
-
it { is_expected.to eq([:kl, :jp]) }
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe '.available_locales=' do
|
|
31
|
-
it "assigns the given locales to @@available_locales" do
|
|
32
|
-
I18n.available_locales = [:kl, :nl, :cn]
|
|
33
|
-
expect(I18n.class_variable_get(:@@available_locales)).to eq([:kl, :nl, :cn])
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Kaminari::Helpers::Tag do
|
|
4
|
-
subject { Kaminari::Helpers::Tag.new(template, options) }
|
|
5
|
-
|
|
6
|
-
let(:template) { double(params: {}) }
|
|
7
|
-
let(:scope) { double(url_for: '') }
|
|
8
|
-
|
|
9
|
-
describe '#page_url_for' do
|
|
10
|
-
context "with scope option given" do
|
|
11
|
-
let(:options) { {scope: scope} }
|
|
12
|
-
|
|
13
|
-
it "calls url_for on that url proxy scope." do
|
|
14
|
-
expect(template).not_to receive(:url_for)
|
|
15
|
-
expect(scope).to receive(:url_for)
|
|
16
|
-
subject.page_url_for(1)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
context "with no scope option given" do
|
|
21
|
-
let(:options) { {} }
|
|
22
|
-
|
|
23
|
-
it "calls url_for on the template." do
|
|
24
|
-
expect(template).to receive(:url_for)
|
|
25
|
-
expect(scope).not_to receive(:url_for)
|
|
26
|
-
subject.page_url_for(1)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module Alchemy
|
|
4
|
-
class ModulesTestController < ApplicationController
|
|
5
|
-
include Modules
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
describe Modules do
|
|
9
|
-
let(:controller) { ModulesTestController.new }
|
|
10
|
-
let(:alchemy_modules) { YAML.load_file(File.expand_path('../../../config/alchemy/modules.yml', __FILE__)) }
|
|
11
|
-
|
|
12
|
-
describe '#module_definition_for' do
|
|
13
|
-
subject { controller.module_definition_for(name) }
|
|
14
|
-
|
|
15
|
-
let(:dashboard_module) { alchemy_modules.first }
|
|
16
|
-
|
|
17
|
-
context 'with a string given as name' do
|
|
18
|
-
let(:name) { 'dashboard' }
|
|
19
|
-
|
|
20
|
-
it "returns the module definition" do
|
|
21
|
-
is_expected.to eq(dashboard_module)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
context 'with a hash given as name' do
|
|
26
|
-
let(:controller_name) { 'alchemy/admin/dashboard' }
|
|
27
|
-
let(:name) { {controller: controller_name, action: 'index'} }
|
|
28
|
-
|
|
29
|
-
it "returns the module definition" do
|
|
30
|
-
is_expected.to eq(dashboard_module)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context 'with leading slash in controller name' do
|
|
34
|
-
let(:controller_name) { '/alchemy/admin/dashboard' }
|
|
35
|
-
|
|
36
|
-
it "returns the module definition" do
|
|
37
|
-
is_expected.to eq(dashboard_module)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
context 'with nil given as name' do
|
|
43
|
-
let(:name) { nil }
|
|
44
|
-
it 'raises an error' do
|
|
45
|
-
expect { subject }.to raise_error(ArgumentError)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe '.register_module' do
|
|
51
|
-
let(:alchemy_module) do
|
|
52
|
-
{
|
|
53
|
-
'name' => 'module',
|
|
54
|
-
'navigation' => {
|
|
55
|
-
'controller' => 'admin/controller_name',
|
|
56
|
-
'action' => 'index'
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "registers a module definition into global list of modules" do
|
|
62
|
-
Modules.register_module(alchemy_module)
|
|
63
|
-
expect(Modules.alchemy_modules).to include(alchemy_module)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|