Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Break up DependencyModule's dual function of providing a "depend_on" …

…DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern.
  • Loading branch information...
commit 4e50a35fa243f6cf7ad567774a9f7c1cb87a1653 1 parent de20324
Joshua Peek josh authored
Showing with 98 additions and 89 deletions.
  1. +1 −1  actionpack/lib/action_controller/abstract/benchmarker.rb
  2. +1 −1  actionpack/lib/action_controller/abstract/callbacks.rb
  3. +1 −1  actionpack/lib/action_controller/abstract/helpers.rb
  4. +1 −1  actionpack/lib/action_controller/abstract/layouts.rb
  5. +1 −1  actionpack/lib/action_controller/abstract/logger.rb
  6. +1 −1  actionpack/lib/action_controller/abstract/renderer.rb
  7. +1 −1  actionpack/lib/action_controller/base/chained/flash.rb
  8. +1 −1  actionpack/lib/action_controller/base/filter_parameter_logging.rb
  9. +1 −1  actionpack/lib/action_controller/base/helpers.rb
  10. +1 −1  actionpack/lib/action_controller/base/request_forgery_protection.rb
  11. +1 −1  actionpack/lib/action_controller/base/streaming.rb
  12. +1 −1  actionpack/lib/action_controller/base/verification.rb
  13. +1 −1  actionpack/lib/action_controller/caching.rb
  14. +1 −1  actionpack/lib/action_controller/new_base/compatibility.rb
  15. +1 −1  actionpack/lib/action_controller/new_base/conditional_get.rb
  16. +1 −1  actionpack/lib/action_controller/new_base/helpers.rb
  17. +1 −1  actionpack/lib/action_controller/new_base/hide_actions.rb
  18. +1 −1  actionpack/lib/action_controller/new_base/layouts.rb
  19. +1 −1  actionpack/lib/action_controller/new_base/rack_convenience.rb
  20. +16 −20 actionpack/lib/action_controller/new_base/render_options.rb
  21. +1 −1  actionpack/lib/action_controller/new_base/renderer.rb
  22. +1 −1  actionpack/lib/action_controller/new_base/rescuable.rb
  23. +1 −1  actionpack/lib/action_controller/new_base/session.rb
  24. +1 −1  actionpack/lib/action_controller/new_base/testing.rb
  25. +1 −1  actionpack/lib/action_controller/new_base/url_for.rb
  26. +1 −1  actionpack/lib/action_controller/testing/integration.rb
  27. +1 −1  actionpack/lib/action_view/render/partials.rb
  28. +1 −1  activerecord/lib/active_record/aggregations.rb
  29. +1 −1  activerecord/lib/active_record/association_preload.rb
  30. +1 −1  activerecord/lib/active_record/associations.rb
  31. +1 −1  activerecord/lib/active_record/attribute_methods.rb
  32. +1 −1  activerecord/lib/active_record/autosave_association.rb
  33. +1 −1  activerecord/lib/active_record/batches.rb
  34. +1 −1  activerecord/lib/active_record/calculations.rb
  35. +1 −1  activerecord/lib/active_record/callbacks.rb
  36. +1 −1  activerecord/lib/active_record/dirty.rb
  37. +1 −1  activerecord/lib/active_record/fixtures.rb
  38. +1 −1  activerecord/lib/active_record/locking/optimistic.rb
  39. +1 −1  activerecord/lib/active_record/named_scope.rb
  40. +1 −1  activerecord/lib/active_record/nested_attributes.rb
  41. +1 −1  activerecord/lib/active_record/observer.rb
  42. +1 −1  activerecord/lib/active_record/reflection.rb
  43. +1 −1  activerecord/lib/active_record/serializers/json_serializer.rb
  44. +1 −1  activerecord/lib/active_record/timestamp.rb
  45. +1 −1  activerecord/lib/active_record/transactions.rb
  46. +1 −1  activerecord/lib/active_record/validations.rb
  47. +1 −1  activerecord/test/cases/associations/eager_load_nested_include_test.rb
  48. +1 −1  activerecord/test/cases/repair_helper.rb
  49. +2 −1  activesupport/lib/active_support/autoload.rb
  50. +22 −0 activesupport/lib/active_support/concern.rb
  51. +1 −11 activesupport/lib/active_support/dependency_module.rb
  52. +10 −10 activesupport/test/{dependency_module_test.rb → concern_test.rb}
2  actionpack/lib/action_controller/abstract/benchmarker.rb
View
@@ -1,6 +1,6 @@
module AbstractController
module Benchmarker
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on Logger
2  actionpack/lib/action_controller/abstract/callbacks.rb
View
@@ -1,6 +1,6 @@
module AbstractController
module Callbacks
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on ActiveSupport::NewCallbacks
2  actionpack/lib/action_controller/abstract/helpers.rb
View
@@ -1,6 +1,6 @@
module AbstractController
module Helpers
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on Renderer
2  actionpack/lib/action_controller/abstract/layouts.rb
View
@@ -1,6 +1,6 @@
module AbstractController
module Layouts
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on Renderer
2  actionpack/lib/action_controller/abstract/logger.rb
View
@@ -3,7 +3,7 @@
module AbstractController
module Logger
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
class DelayedLog
def initialize(&blk)
2  actionpack/lib/action_controller/abstract/renderer.rb
View
@@ -2,7 +2,7 @@
module AbstractController
module Renderer
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on AbstractController::Logger
2  actionpack/lib/action_controller/base/chained/flash.rb
View
@@ -26,7 +26,7 @@ module ActionController #:nodoc:
#
# See docs on the FlashHash class for more details about the flash.
module Flash
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# TODO : Remove the defined? check when new base is the main base
depends_on Session if defined?(ActionController::Http)
2  actionpack/lib/action_controller/base/filter_parameter_logging.rb
View
@@ -1,6 +1,6 @@
module ActionController
module FilterParameterLogging
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
2  actionpack/lib/action_controller/base/helpers.rb
View
@@ -3,7 +3,7 @@
# FIXME: helper { ... } is broken on Ruby 1.9
module ActionController #:nodoc:
module Helpers #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
# Initialize the base module to aggregate its helpers.
2  actionpack/lib/action_controller/base/request_forgery_protection.rb
View
@@ -3,7 +3,7 @@ class InvalidAuthenticityToken < ActionControllerError #:nodoc:
end
module RequestForgeryProtection
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
2  actionpack/lib/action_controller/base/streaming.rb
View
@@ -2,7 +2,7 @@ module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of rendering.
module Streaming
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
2  actionpack/lib/action_controller/base/verification.rb
View
@@ -1,6 +1,6 @@
module ActionController #:nodoc:
module Verification #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# TODO : Remove the defined? check when new base is the main base
if defined?(ActionController::Http)
2  actionpack/lib/action_controller/caching.rb
View
@@ -24,7 +24,7 @@ module ActionController #:nodoc:
# ActionController::Base.cache_store = :mem_cache_store, "localhost"
# ActionController::Base.cache_store = MyOwnStore.new("parameter")
module Caching
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
autoload :Actions, 'action_controller/caching/actions'
autoload :Fragments, 'action_controller/caching/fragments'
2  actionpack/lib/action_controller/new_base/compatibility.rb
View
@@ -1,6 +1,6 @@
module ActionController
module Rails2Compatibility
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
class ::ActionController::ActionControllerError < StandardError #:nodoc:
end
2  actionpack/lib/action_controller/new_base/conditional_get.rb
View
@@ -1,6 +1,6 @@
module ActionController
module ConditionalGet
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on RackConvenience
2  actionpack/lib/action_controller/new_base/helpers.rb
View
@@ -4,7 +4,7 @@
module ActionController
module Helpers
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on AbstractController::Helpers
2  actionpack/lib/action_controller/new_base/hide_actions.rb
View
@@ -1,6 +1,6 @@
module ActionController
module HideActions
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
extlib_inheritable_accessor :hidden_actions
2  actionpack/lib/action_controller/new_base/layouts.rb
View
@@ -1,6 +1,6 @@
module ActionController
module Layouts
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on ActionController::Renderer
depends_on AbstractController::Layouts
2  actionpack/lib/action_controller/new_base/rack_convenience.rb
View
@@ -1,6 +1,6 @@
module ActionController
module RackConvenience
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
delegate :headers, :status=, :location=,
36 actionpack/lib/action_controller/new_base/render_options.rb
View
@@ -1,6 +1,6 @@
module ActionController
module RenderOptions
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
extlib_inheritable_accessor :_renderers
@@ -36,14 +36,12 @@ def render_to_body(options)
end
end
- module RenderOption
- extend ActiveSupport::DependencyModule
+ module RenderOption #:nodoc:
+ def self.extended(base)
+ base.extend ActiveSupport::Concern
+ base.depends_on ::ActionController::RenderOptions
- included do
- extend ActiveSupport::DependencyModule
- depends_on ::ActionController::RenderOptions
-
- def self.register_renderer(name)
+ def base.register_renderer(name)
included { _add_render_option(name) }
end
end
@@ -51,7 +49,7 @@ def self.register_renderer(name)
module Renderers
module Json
- include RenderOption
+ extend RenderOption
register_renderer :json
def _render_json(json, options)
@@ -63,7 +61,7 @@ def _render_json(json, options)
end
module Js
- include RenderOption
+ extend RenderOption
register_renderer :js
def _render_js(js, options)
@@ -73,7 +71,7 @@ def _render_js(js, options)
end
module Xml
- include RenderOption
+ extend RenderOption
register_renderer :xml
def _render_xml(xml, options)
@@ -82,8 +80,8 @@ def _render_xml(xml, options)
end
end
- module Rjs
- include RenderOption
+ module RJS
+ extend RenderOption
register_renderer :update
def _render_update(proc, options)
@@ -94,14 +92,12 @@ def _render_update(proc, options)
end
module All
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
- included do
- include ::ActionController::Renderers::Json
- include ::ActionController::Renderers::Js
- include ::ActionController::Renderers::Xml
- include ::ActionController::Renderers::Rjs
- end
+ depends_on ActionController::Renderers::Json
+ depends_on ActionController::Renderers::Js
+ depends_on ActionController::Renderers::Xml
+ depends_on ActionController::Renderers::RJS
end
end
end
2  actionpack/lib/action_controller/new_base/renderer.rb
View
@@ -1,6 +1,6 @@
module ActionController
module Renderer
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on AbstractController::Renderer
2  actionpack/lib/action_controller/new_base/rescuable.rb
View
@@ -15,7 +15,7 @@ module ActionController #:nodoc:
# behavior is achieved by overriding the <tt>rescue_action_in_public</tt>
# and <tt>rescue_action_locally</tt> methods.
module Rescue
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
include ActiveSupport::Rescuable
2  actionpack/lib/action_controller/new_base/session.rb
View
@@ -1,6 +1,6 @@
module ActionController
module Session
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on RackConvenience
2  actionpack/lib/action_controller/new_base/testing.rb
View
@@ -1,6 +1,6 @@
module ActionController
module Testing
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on RackConvenience
2  actionpack/lib/action_controller/new_base/url_for.rb
View
@@ -1,6 +1,6 @@
module ActionController
module UrlFor
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on RackConvenience
2  actionpack/lib/action_controller/testing/integration.rb
View
@@ -301,7 +301,7 @@ def generic_url_rewriter
# A module used to extend ActionController::Base, so that integration tests
# can capture the controller used to satisfy a request.
module ControllerCapture #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
alias_method_chain :initialize, :capture
2  actionpack/lib/action_view/render/partials.rb
View
@@ -171,7 +171,7 @@ module ActionView
# <% end %>
module Partials
extend ActiveSupport::Memoizable
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
attr_accessor :_partial
2  activerecord/lib/active_record/aggregations.rb
View
@@ -1,6 +1,6 @@
module ActiveRecord
module Aggregations # :nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
def clear_aggregation_cache #:nodoc:
self.class.reflect_on_all_aggregations.to_a.each do |assoc|
2  activerecord/lib/active_record/association_preload.rb
View
@@ -1,7 +1,7 @@
module ActiveRecord
# See ActiveRecord::AssociationPreload::ClassMethods for documentation.
module AssociationPreload #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# Implements the details of eager loading of ActiveRecord associations.
# Application developers should not use this module directly.
2  activerecord/lib/active_record/associations.rb
View
@@ -79,7 +79,7 @@ def initialize(reflection)
# See ActiveRecord::Associations::ClassMethods for documentation.
module Associations # :nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# These classes will be loaded when associations are created.
# So there is no need to eager load them.
2  activerecord/lib/active_record/attribute_methods.rb
View
@@ -2,7 +2,7 @@
module ActiveRecord
module AttributeMethods #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
DEFAULT_SUFFIXES = %w(= ? _before_type_cast)
ATTRIBUTE_TYPES_CACHED_BY_DEFAULT = [:datetime, :timestamp, :time, :date]
2  activerecord/lib/active_record/autosave_association.rb
View
@@ -125,7 +125,7 @@ module ActiveRecord
# post.author.name = ''
# post.save(false) # => true
module AutosaveAssociation
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
ASSOCIATION_TYPES = %w{ has_one belongs_to has_many has_and_belongs_to_many }
2  activerecord/lib/active_record/batches.rb
View
@@ -1,6 +1,6 @@
module ActiveRecord
module Batches # :nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# When processing large numbers of records, it's often a good idea to do
# so in batches to prevent memory ballooning.
2  activerecord/lib/active_record/calculations.rb
View
@@ -1,6 +1,6 @@
module ActiveRecord
module Calculations #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
CALCULATIONS_OPTIONS = [:conditions, :joins, :order, :select, :group, :having, :distinct, :limit, :offset, :include, :from]
2  activerecord/lib/active_record/callbacks.rb
View
@@ -211,7 +211,7 @@ module ActiveRecord
# needs to be aware of it because an ordinary +save+ will raise such exception
# instead of quietly returning +false+.
module Callbacks
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
CALLBACKS = %w(
after_find after_initialize before_save after_save before_create after_create before_update after_update before_validation
2  activerecord/lib/active_record/dirty.rb
View
@@ -34,7 +34,7 @@ module ActiveRecord
# person.name << 'by'
# person.name_change # => ['uncle bob', 'uncle bobby']
module Dirty
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
DIRTY_SUFFIXES = ['_changed?', '_change', '_will_change!', '_was']
2  activerecord/lib/active_record/fixtures.rb
View
@@ -807,7 +807,7 @@ def find
module ActiveRecord
module TestFixtures
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
setup :setup_fixtures
2  activerecord/lib/active_record/locking/optimistic.rb
View
@@ -42,7 +42,7 @@ module Locking
# To override the name of the lock_version column, invoke the <tt>set_locking_column</tt> method.
# This method uses the same syntax as <tt>set_table_name</tt>
module Optimistic
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
cattr_accessor :lock_optimistically, :instance_writer => false
2  activerecord/lib/active_record/named_scope.rb
View
@@ -3,7 +3,7 @@
module ActiveRecord
module NamedScope
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# All subclasses of ActiveRecord::Base have one named scope:
# * <tt>scoped</tt> - which allows for the creation of anonymous \scopes, on the fly: <tt>Shirt.scoped(:conditions => {:color => 'red'}).scoped(:include => :washing_instructions)</tt>
2  activerecord/lib/active_record/nested_attributes.rb
View
@@ -3,7 +3,7 @@
module ActiveRecord
module NestedAttributes #:nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
class_inheritable_accessor :reject_new_nested_attributes_procs, :instance_writer => false
2  activerecord/lib/active_record/observer.rb
View
@@ -3,7 +3,7 @@
module ActiveRecord
module Observing # :nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
module ClassMethods
# Activates the observers assigned. Examples:
2  activerecord/lib/active_record/reflection.rb
View
@@ -1,6 +1,6 @@
module ActiveRecord
module Reflection # :nodoc:
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
# Reflection allows you to interrogate Active Record classes and objects about their associations and aggregations.
# This information can, for example, be used in a form builder that took an Active Record object and created input
2  activerecord/lib/active_record/serializers/json_serializer.rb
View
@@ -2,7 +2,7 @@
module ActiveRecord #:nodoc:
module Serialization
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
cattr_accessor :include_root_in_json, :instance_writer => false
2  activerecord/lib/active_record/timestamp.rb
View
@@ -8,7 +8,7 @@ module ActiveRecord
# Timestamps are in the local timezone by default but you can use UTC by setting
# <tt>ActiveRecord::Base.default_timezone = :utc</tt>
module Timestamp
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
alias_method_chain :create, :timestamps
2  activerecord/lib/active_record/transactions.rb
View
@@ -3,7 +3,7 @@
module ActiveRecord
# See ActiveRecord::Transactions::ClassMethods for documentation.
module Transactions
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
class TransactionError < ActiveRecordError # :nodoc:
end
2  activerecord/lib/active_record/validations.rb
View
@@ -302,7 +302,7 @@ def to_xml(options={})
#
# An Errors object is automatically created for every Active Record.
module Validations
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
VALIDATIONS = %w( validate validate_on_create validate_on_update )
2  activerecord/test/cases/associations/eager_load_nested_include_test.rb
View
@@ -7,7 +7,7 @@
require 'active_support/core_ext/array/random_access'
module Remembered
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
included do
after_create :remember
2  activerecord/test/cases/repair_helper.rb
View
@@ -1,7 +1,7 @@
module ActiveRecord
module Testing
module RepairHelper
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
module Toolbox
def self.record_validations(*model_classes)
3  activesupport/lib/active_support/autoload.rb
View
@@ -5,7 +5,7 @@ module ActiveSupport
autoload :BufferedLogger, 'active_support/buffered_logger'
autoload :Cache, 'active_support/cache'
autoload :Callbacks, 'active_support/callbacks'
- autoload :NewCallbacks, 'active_support/new_callbacks'
+ autoload :Concern, 'active_support/concern'
autoload :ConcurrentHash, 'active_support/concurrent_hash'
autoload :DependencyModule, 'active_support/dependency_module'
autoload :Deprecation, 'active_support/deprecation'
@@ -15,6 +15,7 @@ module ActiveSupport
autoload :MessageEncryptor, 'active_support/message_encryptor'
autoload :MessageVerifier, 'active_support/message_verifier'
autoload :Multibyte, 'active_support/multibyte'
+ autoload :NewCallbacks, 'active_support/new_callbacks'
autoload :OptionMerger, 'active_support/option_merger'
autoload :OrderedHash, 'active_support/ordered_hash'
autoload :OrderedOptions, 'active_support/ordered_options'
22 activesupport/lib/active_support/concern.rb
View
@@ -0,0 +1,22 @@
+require 'active_support/dependency_module'
+
+module ActiveSupport
+ module Concern
+ include DependencyModule
+
+ def append_features(base)
+ if super
+ base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
+ base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
+ end
+ end
+
+ def included(base = nil, &block)
+ if base.nil?
+ @_included_block = block
+ else
+ super
+ end
+ end
+ end
+end
12 activesupport/lib/active_support/dependency_module.rb
View
@@ -1,19 +1,9 @@
module ActiveSupport
module DependencyModule
def append_features(base)
- return if base < self
+ return false if base < self
(@_dependencies ||= []).each { |dep| base.send(:include, dep) }
super
- base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
- base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
- end
-
- def included(base = nil, &block)
- if base.nil?
- @_included_block = block
- else
- super
- end
end
def depends_on(*mods)
20 activesupport/test/dependency_module_test.rb → activesupport/test/concern_test.rb
View
@@ -1,9 +1,9 @@
require 'abstract_unit'
-require 'active_support/dependency_module'
+require 'active_support/concern'
-class DependencyModuleTest < Test::Unit::TestCase
+class ConcernTest < Test::Unit::TestCase
module Baz
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
module ClassMethods
def baz
@@ -29,7 +29,7 @@ def baz
end
module Bar
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on Baz
@@ -43,7 +43,7 @@ def baz
end
module Foo
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
depends_on Bar, Baz
end
@@ -55,17 +55,17 @@ def setup
def test_module_is_included_normally
@klass.send(:include, Baz)
assert_equal "baz", @klass.new.baz
- assert_equal DependencyModuleTest::Baz, @klass.included_modules[0]
+ assert_equal ConcernTest::Baz, @klass.included_modules[0]
@klass.send(:include, Baz)
assert_equal "baz", @klass.new.baz
- assert_equal DependencyModuleTest::Baz, @klass.included_modules[0]
+ assert_equal ConcernTest::Baz, @klass.included_modules[0]
end
def test_class_methods_are_extended
@klass.send(:include, Baz)
assert_equal "baz", @klass.baz
- assert_equal DependencyModuleTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0]
+ assert_equal ConcernTest::Baz::ClassMethods, (class << @klass; self.included_modules; end)[0]
end
def test_included_block_is_ran
@@ -78,11 +78,11 @@ def test_modules_dependencies_are_met
assert_equal "bar", @klass.new.bar
assert_equal "bar+baz", @klass.new.baz
assert_equal "baz", @klass.baz
- assert_equal [DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..1]
+ assert_equal [ConcernTest::Bar, ConcernTest::Baz], @klass.included_modules[0..1]
end
def test_depends_on_with_multiple_modules
@klass.send(:include, Foo)
- assert_equal [DependencyModuleTest::Foo, DependencyModuleTest::Bar, DependencyModuleTest::Baz], @klass.included_modules[0..2]
+ assert_equal [ConcernTest::Foo, ConcernTest::Bar, ConcernTest::Baz], @klass.included_modules[0..2]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.