Module: Alchemy Deprecated
- Defined in:
- app/models/alchemy/tag.rb,
app/models/alchemy/node.rb,
app/models/alchemy/page.rb,
app/models/alchemy/site.rb,
app/models/alchemy/content.rb,
app/models/alchemy/element.rb,
app/models/alchemy/message.rb,
app/models/alchemy/picture.rb,
app/models/alchemy/language.rb,
app/models/alchemy/attachment.rb,
app/helpers/alchemy/url_helper.rb,
app/models/alchemy/base_record.rb,
app/models/alchemy/folded_page.rb,
app/models/alchemy/picture/url.rb,
app/models/alchemy/site/layout.rb,
app/helpers/alchemy/base_helper.rb,
app/mailers/alchemy/base_mailer.rb,
app/models/alchemy/essence_date.rb,
app/models/alchemy/essence_file.rb,
app/models/alchemy/essence_html.rb,
app/models/alchemy/essence_link.rb,
app/models/alchemy/essence_page.rb,
app/models/alchemy/essence_text.rb,
app/helpers/alchemy/pages_helper.rb,
app/models/alchemy/page/url_path.rb,
app/models/alchemy/essence_select.rb,
app/models/alchemy/content/factory.rb,
app/models/alchemy/element_to_page.rb,
app/models/alchemy/essence_boolean.rb,
app/models/alchemy/essence_picture.rb,
app/helpers/alchemy/elements_helper.rb,
app/helpers/alchemy/essences_helper.rb,
app/mailers/alchemy/messages_mailer.rb,
app/models/alchemy/essence_richtext.rb,
app/models/alchemy/page/page_naming.rb,
app/models/alchemy/page/page_scopes.rb,
app/models/alchemy/page/page_natures.rb,
app/decorators/alchemy/content_editor.rb,
app/helpers/alchemy/admin/base_helper.rb,
app/helpers/alchemy/admin/form_helper.rb,
app/helpers/alchemy/admin/tags_helper.rb,
app/models/alchemy/element/presenters.rb,
app/models/alchemy/page/page_elements.rb,
app/helpers/alchemy/admin/pages_helper.rb,
app/models/alchemy/element/definitions.rb,
app/controllers/alchemy/base_controller.rb,
app/models/alchemy/essence_picture_view.rb,
app/serializers/alchemy/base_serializer.rb,
app/serializers/alchemy/node_serializer.rb,
app/serializers/alchemy/page_serializer.rb,
app/controllers/alchemy/pages_controller.rb,
app/models/alchemy/page/fixed_attributes.rb,
app/helpers/alchemy/admin/contents_helper.rb,
app/helpers/alchemy/admin/elements_helper.rb,
app/helpers/alchemy/admin/essences_helper.rb,
app/helpers/alchemy/admin/pictures_helper.rb,
app/helpers/alchemy/elements_block_helper.rb,
app/models/alchemy/picture/transformations.rb,
app/serializers/alchemy/content_serializer.rb,
app/serializers/alchemy/element_serializer.rb,
app/serializers/alchemy/picture_serializer.rb,
app/controllers/alchemy/api/base_controller.rb,
app/controllers/alchemy/elements_controller.rb,
app/controllers/alchemy/messages_controller.rb,
app/helpers/alchemy/admin/navigation_helper.rb,
app/models/alchemy/element/element_contents.rb,
app/models/alchemy/element/element_essences.rb,
app/controllers/alchemy/api/nodes_controller.rb,
app/controllers/alchemy/api/pages_controller.rb,
app/helpers/alchemy/admin/attachments_helper.rb,
app/models/concerns/alchemy/content_touching.rb,
app/serializers/alchemy/page_tree_serializer.rb,
app/controllers/alchemy/admin/base_controller.rb,
app/controllers/alchemy/admin/tags_controller.rb,
app/serializers/alchemy/attachment_serializer.rb,
app/controllers/alchemy/admin/nodes_controller.rb,
app/controllers/alchemy/admin/pages_controller.rb,
app/controllers/alchemy/admin/sites_controller.rb,
app/controllers/alchemy/admin/trash_controller.rb,
app/controllers/alchemy/attachments_controller.rb,
app/controllers/alchemy/api/contents_controller.rb,
app/controllers/alchemy/api/elements_controller.rb,
app/controllers/concerns/alchemy/page_redirects.rb,
app/controllers/concerns/alchemy/site_redirects.rb,
app/serializers/alchemy/essence_date_serializer.rb,
app/serializers/alchemy/essence_file_serializer.rb,
app/serializers/alchemy/essence_html_serializer.rb,
app/serializers/alchemy/essence_link_serializer.rb,
app/serializers/alchemy/essence_text_serializer.rb,
app/controllers/alchemy/admin/contents_controller.rb,
app/controllers/alchemy/admin/elements_controller.rb,
app/controllers/alchemy/admin/pictures_controller.rb,
app/controllers/concerns/alchemy/locale_redirects.rb,
app/serializers/alchemy/essence_select_serializer.rb,
app/serializers/alchemy/legacy_element_serializer.rb,
app/controllers/alchemy/admin/clipboard_controller.rb,
app/controllers/alchemy/admin/dashboard_controller.rb,
app/controllers/alchemy/admin/languages_controller.rb,
app/controllers/alchemy/admin/resources_controller.rb,
app/serializers/alchemy/essence_boolean_serializer.rb,
app/serializers/alchemy/essence_picture_serializer.rb,
app/controllers/alchemy/admin/styleguide_controller.rb,
app/serializers/alchemy/essence_richtext_serializer.rb,
app/controllers/alchemy/admin/attachments_controller.rb,
app/controllers/alchemy/admin/layoutpages_controller.rb,
app/controllers/alchemy/admin/essence_files_controller.rb,
app/controllers/concerns/alchemy/admin/archive_overlay.rb,
app/controllers/concerns/alchemy/legacy_page_redirects.rb,
app/controllers/alchemy/admin/essence_pictures_controller.rb,
app/controllers/alchemy/admin/legacy_page_urls_controller.rb,
app/controllers/concerns/alchemy/admin/uploader_responses.rb,
lib/alchemy_cms.rb,
lib/alchemy/i18n.rb,
lib/alchemy/hints.rb,
lib/alchemy/paths.rb,
lib/alchemy/shell.rb,
lib/alchemy/config.rb,
lib/alchemy/engine.rb,
lib/alchemy/errors.rb,
lib/alchemy/logger.rb,
lib/alchemy/seeder.rb,
lib/alchemy/essence.rb,
lib/alchemy/modules.rb,
lib/alchemy/tinymce.rb,
lib/alchemy/version.rb,
lib/alchemy/resource.rb,
lib/alchemy/taggable.rb,
lib/alchemy/upgrader.rb,
lib/alchemy/filetypes.rb,
lib/alchemy/tasks/tidy.rb,
lib/alchemy/deprecation.rb,
lib/alchemy/page_layout.rb,
lib/alchemy/permissions.rb,
lib/alchemy/admin/locale.rb,
lib/alchemy/forms/builder.rb,
lib/alchemy/tasks/helpers.rb,
lib/alchemy/auth_accessors.rb,
lib/alchemy/on_page_layout.rb,
lib/alchemy/ssl_protection.rb,
lib/alchemy/elements_finder.rb,
lib/alchemy/name_conversions.rb,
lib/alchemy/resources_helper.rb,
lib/alchemy/controller_actions.rb,
lib/alchemy/routing_constraints.rb,
lib/alchemy/configuration_methods.rb,
lib/rails/generators/alchemy/base.rb,
lib/alchemy/upgrader/four_point_one.rb,
lib/alchemy/upgrader/four_point_six.rb,
lib/alchemy/upgrader/four_point_two.rb,
lib/alchemy/upgrader/four_point_four.rb,
lib/alchemy/test_support/config_stubbing.rb,
lib/alchemy/cache_digests/template_tracker.rb,
lib/alchemy/on_page_layout/callbacks_runner.rb,
lib/alchemy/test_support/controller_requests.rb,
lib/alchemy/test_support/integration_helpers.rb,
lib/rails/generators/alchemy/menus/menus_generator.rb,
lib/rails/generators/alchemy/views/views_generator.rb,
lib/alchemy/upgrader/tasks/picture_gallery_migration.rb,
lib/rails/generators/alchemy/module/module_generator.rb,
lib/rails/generators/alchemy/essence/essence_generator.rb,
lib/rails/generators/alchemy/install/install_generator.rb,
lib/rails/generators/alchemy/elements/elements_generator.rb,
lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb,
lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb
Overview
Use Rails build in test request methods instead
*There is generally no need* to use this module. Instead, in a functional/controller test against a Alchemy controller, just use standard Rails functionality by including:
routes { Alchemy::Engine.routes }
And then use standard Rails test ‘get`, `post` etc methods.
Use this module to easily test Alchemy actions within Alchemy components or inside your application to test routes for the mounted Alchemy engine.
Inside your spec_helper.rb, include this module inside the RSpec.configure block by doing this:
require 'alchemy/test_support/controller_requests'
RSpec.configure do |c|
c.include Alchemy::TestSupport::ControllerRequests, type: :controller
end
Then, in your controller tests, you can access alchemy routes like this:
require 'rails_helper'
describe Alchemy::Admin::PagesController do
it "can see all the pages" do
alchemy_get :index
end
end
Use alchemy_get, alchemy_post, alchemy_put or alchemy_delete to make requests to the Alchemy engine, and use regular get, post, put or delete to make requests to your application.
Note: Based on Spree::TestingSupport::ControllerRequests. Thanks <3
Defined Under Namespace
Modules: AbilityHelper, Admin, BaseHelper, CacheDigests, ConfigurationMethods, ContentTouching, ControllerActions, ElementsBlockHelper, ElementsHelper, Essence, EssencesHelper, Filetypes, Forms, Generators, Hints, I18n, LegacyPageRedirects, LocaleRedirects, Logger, Modules, NameConversions, OnPageLayout, PageRedirects, PagesHelper, ResourcesHelper, SSLProtection, Shell, SiteRedirects, Taggable, Tasks, TestSupport, Tinymce, UrlHelper Classes: Attachment, AttachmentSerializer, AttachmentsController, BaseController, BaseMailer, BaseRecord, BaseSerializer, Config, Content, ContentDefinitionError, ContentEditor, ContentSerializer, DefaultLanguageNotDeletable, DefaultLanguageNotFoundError, DefaultSiteNotFoundError, Element, ElementDefinitionError, ElementSerializer, ElementToPage, ElementsController, ElementsFinder, Engine, EssenceBoolean, EssenceBooleanSerializer, EssenceDate, EssenceDateSerializer, EssenceFile, EssenceFileSerializer, EssenceHtml, EssenceHtmlSerializer, EssenceLink, EssenceLinkSerializer, EssenceMissingError, EssencePage, EssencePicture, EssencePictureSerializer, EssencePictureView, EssenceRichtext, EssenceRichtextSerializer, EssenceSelect, EssenceSelectSerializer, EssenceText, EssenceTextSerializer, FoldedPage, IngredientAssociation, Language, LegacyElementSerializer, LegacyPageUrl, Message, MessagesController, MessagesMailer, MissingActiveRecordAssociation, MissingImageFileError, NoCurrentUserFoundError, Node, NodeSerializer, NotMountedError, Page, PageLayout, PageSerializer, PageTreeSerializer, PagesController, Permissions, Picture, PictureInUseError, PictureSerializer, Resource, RoutingConstraints, Seeder, Site, Tag, Tidy, TinymceError, UpdateServiceUnavailable, Upgrader, WrongImageFormatError
Constant Summary collapse
- YAML_WHITELIST_CLASSES =
%w(Symbol Date Regexp)
- VERSION =
"4.6.1"
- Deprecation =
ActiveSupport::Deprecation.new('5.0', 'Alchemy')
- @@admin_path =
Defaults
'admin'
- @@admin_constraints =
{}
- @@user_class_name =
Defaults
'User'
- @@user_class_primary_key =
:id
- @@current_user_method =
'current_user'
- @@signup_path =
'/signup'
- @@login_path =
'/login'
- @@logout_path =
'/logout'
- @@logout_method =
'delete'
Class Method Summary collapse
- .gem_version ⇒ Object
-
.register_ability(klass) ⇒ Object
Register a CanCan Ability class.
-
.registered_abilities ⇒ Object
All CanCan Ability classes registered to Alchemy.
-
.t(msg, *args) ⇒ Object
Alchemy shortcut translation method.
- .table_name_prefix ⇒ Object
- .user_class ⇒ Object
-
.user_class_name ⇒ Object
- Prefix with
-
when getting to avoid constant name conflicts.
- .user_class_name=(user_class_name) ⇒ Object
- .version ⇒ Object
Class Method Details
.gem_version ⇒ Object
10 11 12 |
# File 'lib/alchemy/version.rb', line 10 def self.gem_version Gem::Version.new(VERSION) end |
.register_ability(klass) ⇒ Object
Register a CanCan Ability class
111 112 113 114 |
# File 'lib/alchemy/auth_accessors.rb', line 111 def self.register_ability(klass) @abilities ||= [] @abilities << klass end |
.registered_abilities ⇒ Object
All CanCan Ability classes registered to Alchemy
118 119 120 |
# File 'lib/alchemy/auth_accessors.rb', line 118 def self.registered_abilities @abilities ||= [] end |
.t(msg, *args) ⇒ Object
15 16 17 |
# File 'lib/alchemy/i18n.rb', line 15 def t(msg, *args) Alchemy::I18n.translate(msg, *args) end |
.table_name_prefix ⇒ Object
2 3 4 |
# File 'app/models/alchemy/base_record.rb', line 2 def self.table_name_prefix 'alchemy_' end |
.user_class ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/alchemy/auth_accessors.rb', line 88 def self.user_class @@user_class ||= begin @@user_class_name.constantize rescue NameError => e if e. =~ /#{Regexp.escape(@@user_class_name)}/ abort <<-MSG.strip_heredoc AlchemyCMS cannot find any user class! Please add a user class and tell Alchemy about it or, if you don't want to create your own class, add the `alchemy-devise` gem to your Gemfile. bundle add alchemy-devise MSG else raise e end end end |
.user_class_name ⇒ Object
- Prefix with
-
when getting to avoid constant name conflicts
77 78 79 80 81 82 |
# File 'lib/alchemy/auth_accessors.rb', line 77 def self.user_class_name if !@@user_class_name.is_a?(String) raise TypeError, 'Alchemy.user_class_name must be a String, not a Class.' end "::#{@@user_class_name}" end |
.user_class_name=(user_class_name) ⇒ Object
84 85 86 |
# File 'lib/alchemy/auth_accessors.rb', line 84 def self.user_class_name=(user_class_name) @@user_class_name = user_class_name end |
.version ⇒ Object
6 7 8 |
# File 'lib/alchemy/version.rb', line 6 def self.version VERSION end |