lib/genspec/matchers/generation_method_matcher.rb
# The modules whose public instance methods will be converted into GenSpec matchers.
# See #generation_methods for details.
#
# By default, this includes all of the following:
#
# * +Thor::Actions+
# * +Rails::Generators::Actions+
# * +Rails::Generators::Migration+
#
# If Rails has not been loaded, (e.g. you are testing Thor generators, not Rails generators),
# the Rails modules are silently ignored.
#
# You can add any additional modules to this list. Note that you should list them 
# in the form of a String representing the module name, rather than adding the modules
# themselves. This allows you to add them prior to actually load them.
#
# This will only take effect _before_ the specs have been executed; it is best done from
# within the +spec_helper.rb+ file during the load process.
#
The modules whose public instance methods will be converted into GenSpec matchers.
See #generation_methods for details.

By default, this includes all of the following.



If Rails has not been loaded, ,
the Rails modules are silently ignored.

You can add any additional modules to this list. Note that you should list them
in the form of a String representing the module name, rather than adding the modules
themselves. This allows you to add them prior to actually load them.

This will only take effect _before_ the specs have been executed; it is best done from
within the +spec_helper.rb+ file during the load process.
The modules whose public instance methods will be converted into GenSpec matchers . See #generation_methods for details . By default this includes all of the following . If Rails has not been loaded the Rails modules are silently ignored . You can add any additional modules to this list . Note that you should list them in the form of a String representing the module name rather than adding the modules themselves . This allows you to add them prior to actually load them . This will only take effect _before_ the specs have been executed ; it is best done from within the + spec_helper . rb + file during the load process .
def invoking
    method_name = self.method_name
    interceptor = self
    generator.class_eval do
      no_tasks do
        define_method :"#{method_name}_with_intercept" do |*argus, &block|
          expected_args = interceptor.method_args
          if expected_args.length > 0
            actual_args = argus[0...expected_args.length]
            if actual_args == expected_args
              interceptor.match!
            else
              interceptor.report_actual_args actual_args
            end
          else
            interceptor.match!
          end
          send(:"#{method_name}_without_intercept", *argus, &block)
        end
        alias_method :"#{method_name}_without_intercept", :"#{method_name}"
        alias_method :"#{method_name}", :"#{method_name}_with_intercept"
      end
    end
  end
def invoking method_name = self . method_name interceptor = self generator . class_eval do no_tasks do define_method :" #{ method_name } _with_intercept " do | * argus , & block | expected_args = interceptor . method_args if expected_args . length > 0 actual_args = argus [ 0 ... expected_args . length ] if actual_args == expected_args interceptor . match! else interceptor . report_actual_args actual_args end else interceptor . match! end send ( :" #{ method_name } _without_intercept " , * argus , & block ) end alias_method :" #{ method_name } _without_intercept " , :" #{ method_name } " alias_method :" #{ method_name } " , :" #{ method_name } _with_intercept " end end end
The modules whose public instance methods will be converted into GenSpec matchers.
The modules whose public instance methods will be converted into GenSpec matchers .
# we've already matched the method, and there are no expected args.