class Object

Public Instance Methods

after() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 74
def after; end
after_filter_action() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 70
def after_filter_action;  respond_to; end
after_nothing() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 77
def after_nothing; end
before() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 72
def before; end
before2() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 73
def before2; end
before_filter_action() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 69
def before_filter_action; respond_to; end
before_nothing() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 76
def before_nothing; end
create() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 51
def create
  a = Asd.new
  a.save!
  respond_to
end
destroy() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 59
def destroy; respond_to; end
edit() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 57
def edit;    respond_to; end
index() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 47
def index;   respond_to; end
initialize_test_context() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 11
def initialize_test_context
  Object.lookup_or_create_class('::Asd', ActiveRecord::Base).class_exec do
    has_many :blahs, :class_name => 'Mod::Blah'
    has_many :kmes, :through => :blahs, :source => :kme12, :dependent => :destroy
  end
  
  Object.lookup_or_create_class('::Kme', Asd).class_exec do
    belongs_to :blah, :class_name => 'Mod::Blah', :dependent => :delete
  end
  
  Object.lookup_or_create_class('::Mod::Blah', ActiveRecord::Base).class_exec do
    belongs_to :asd
    has_one :kme12, :class_name => 'Kme', :dependent => :delete
  end

  Object.lookup_or_create_class('::ApplicationController', ActionController::Base).class_exec do
    def respond_to
      # allow for empty render statements, for testing purposes only
      if block_given?
        super
      else
        render :nothing => true
      end
    end

    def render(options = {}, extra_options = nil, &block)
      options ||= {}
      options[:nothing] = true
      super
    end

    # no templates exist and we do not care
    rescue_from ActionView::MissingTemplate do; end
  end

  Object.lookup_or_create_class('::AsdsController', ApplicationController).class_exec do
    def index;   respond_to; end
    def show;    respond_to; end
    def new;     respond_to; end

    def create
      a = Asd.new
      a.save!
      respond_to
    end

    def edit;    respond_to; end
    def update;  respond_to; end
    def destroy; respond_to; end
    def nothing; respond_to; end

    before_filter :before,  :only => :before_filter_action
    before_filter :before2, :only => :before_filter_action
    after_filter  :after,   :only => :after_filter_action

    before_filter :before_nothing, :only => :nothing
    after_filter  :after_nothing,  :only => :nothing

    def before_filter_action; respond_to; end
    def after_filter_action;  respond_to; end
    
    def before; end
    def before2; end
    def after; end

    def before_nothing; end
    def after_nothing; end
  end
end
new() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 49
def new;     respond_to; end
nothing() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 60
def nothing; respond_to; end
render(options = {}, extra_options = nil, &block) click to toggle source
Calls superclass method
# File lib/adsl/extract/rails/rails_test_helper.rb, line 36
def render(options = {}, extra_options = nil, &block)
  options ||= {}
  options[:nothing] = true
  super
end
replace_method(method_name, source = nil, &block) click to toggle source
# File lib/adsl/extract/meta.rb, line 5
def replace_method(method_name, source = nil, &block)
  raise "Object #{self} of class #{self.class} does not respond to #{method_name}" unless self.respond_to? method_name, true
  
  im = self.singleton_class.instance_method(method_name)
  
  aliases = []
  self.singleton_class.instance_methods.each do |other_name|
    next if other_name == method_name
    other = self.singleton_class.instance_method other_name
    aliases << [other_name, other] if other == im
  end

  owner = im.owner

  unless source.nil?
    owner.class_eval source
  else
    owner.send :define_method, method_name, &block
  end

  aliases.each do |other_name, other|
    other.owner.class_exec do
      alias_method other_name, method_name
    end
  end

  true
end
respond_to() click to toggle source
Calls superclass method
# File lib/adsl/extract/rails/rails_test_helper.rb, line 27
def respond_to
  # allow for empty render statements, for testing purposes only
  if block_given?
    super
  else
    render :nothing => true
  end
end
show() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 48
def show;    respond_to; end
update() click to toggle source
# File lib/adsl/extract/rails/rails_test_helper.rb, line 58
def update;  respond_to; end