Module: RailsExtension::ActiveSupportExtension::TestCase

Defined in:
lib/rails_extension/active_support_extension/test_case.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rails_extension/active_support_extension/test_case.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
  base.send(:include, InstanceMethods)
  base.alias_method_chain :method_missing, :create_object

# I can't seem to find out how to confirm that 
# method_missing_without_create_object
# doesn't already exist! WTF
# We don't want to alias it if we already have.
# tried viewing methods, instance_methods, etc.
# seems to only work when "inherited" and since 
# some thing are inherited from subclasses it
# might get a bit hairy.  No problems now, just
# trying to avoid them in the future.

  base.class_eval do
#alias_method(:method_missing_without_create_object,:method_missing)
#alias_method(:method_missing,:method_missing_with_create_object)
#     class << self
#       alias_method_chain :method_missing, :create_object #unless
#         respond_to?(:method_missing_without_create_object)
#     end
    class << self
      alias_method_chain( :test, :verbosity ) unless method_defined?(:test_without_verbosity)
    end
  end #unless base.respond_to?(:test_without_verbosity)
#puts base.respond_to?(:method_missing_without_create_object)
#puts base.method_defined?(:method_missing_without_create_object)
# apparently medding with method_missing is also a bit of an issue
end