lib/genspec/matchers/generation_method_matcher.rb
# Returns all public instance methods found in the modules listed in 
# GENERATION_CLASSES. This is the list of methods that will be converted
# into matchers, which can be used like so:
#
#   expect(subject).to create_file(. . .)
#
# See also GENERATION_CLASSES
#
Returns all public instance methods found in the modules listed in
GENERATION_CLASSES. This is the list of methods that will be converted
into matchers, which can be used like so.




Returns all public instance methods found in the modules listed in GENERATION_CLASSES . This is the list of methods that will be converted into matchers which can be used like so .
def generation_methods
      GENERATION_CLASSES.inject([]) do |arr, mod|
        if mod.kind_of?(String)
          next arr if !GenSpec.rails? && mod =~ /^Rails/
          mod = mod.split('::').inject(Kernel) do |container, name|
            container && container.const_get(name)
          end
        end
        arr.concat mod.public_instance_methods.collect { |i| i.to_s }.reject { |i| i =~ /=/ }
        arr
      end.uniq.sort
    end
def generation_methods GENERATION_CLASSES . inject ( [ ] ) do | arr , mod | if mod . kind_of? ( String ) next arr if ! GenSpec . rails? && mod =~ / ^Rails / mod = mod . split ( '::' ) . inject ( Kernel ) do | container , name | container && container . const_get ( name ) end end arr . concat mod . public_instance_methods . collect { | i | i . to_s } . reject { | i | i =~ / = / } arr end . uniq . sort end
Returns all public instance methods found in the modules listed in
GENERATION_CLASSES.
Returns all public instance methods found in the modules listed in GENERATION_CLASSES .