spec/generator_spec_helper.rb
# asserts that the given methods are defined in the body.
# This does assume standard rails code conventions with regards to the source code.
# The body of each individual method is passed to a block.
asserts that the given methods are defined in the body.
This does assume standard rails code conventions with regards to the source code.
The body of each individual method is passed to a block.
asserts that the given methods are defined in the body . This does assume standard rails code conventions with regards to the source code . The body of each individual method is passed to a block .
def has_method?(body,*methods)
      methods.each do |name|
        it "should define the method #{name.to_s}" do
          body.should match(/^  def #{name.to_s}\n((\n|   .*\n)*)  end/)
        end
        yield( name, $1 ) if block_given?
      end
    end
def has_method? ( body , * methods ) methods . each do | name | it "should define the method #{name.to_s}" do body . should match ( / ^  def  #{ name . to_s } \n (( \n |   .* \n )*)  end / ) end yield ( name , $1 ) if block_given? end end
asserts that the given methods are defined in the body.
asserts that the given methods are defined in the body .
body
<not_specific>
methods
<not_specific>