lib/carbonado.rb
# This method stubs the Kernel#gem method to make it a noop for the code executed in the yielded 
# block. This method is useful if there is a gem that uses the Kernel#gem method to activate a
# gem from the bundle that you have already activated using the activate_gem method above. One
# example is the ActiveRecord::Base.establish_connection method. Depending on the adapter, this
# will try to activate the appropriate gem using the 'gem' method, which will fail because our
# approach doesn't alter the bundle. I guess this is a TODO, since it may be possible to update
# the bundle so that the gem method will succeed which would be a better solution.
This method stubs the Kernel#gem method to make it a noop for the code executed in the yielded
block. This method is useful if there is a gem that uses the Kernel#gem method to activate a
gem from the bundle that you have already activated using the activate_gem method above.
This method stubs the Kernel#gem method to make it a noop for the code executed in the yielded block . This method is useful if there is a gem that uses the Kernel#gem method to activate a gem from the bundle that you have already activated using the activate_gem method above .
def stub_gem_method
    Kernel.define_method :fake_gem do |*args|
    end
    Kernel.alias_method :real_gem, :gem
    Kernel.alias_method :gem, :fake_gem
    yield
    Kernel.alias_method :gem, :real_gem
  end
def stub_gem_method Kernel . define_method :fake_gem do | * args | end Kernel . alias_method :real_gem , :gem Kernel . alias_method :gem , :fake_gem yield Kernel . alias_method :gem , :real_gem end
This method stubs the Kernel#gem method to make it a noop for the code executed in the yielded
block.
This method stubs the Kernel#gem method to make it a noop for the code executed in the yielded block .