Categories
Code Curated

Fake Rails environment

Wherein I use my powers for good/evil

For testing some bits inside of ActiveRecord proper.

module Rails
  def self.env
    o = Class.new do
      def production?
        true
      end
    end
    o.new
  end
end

Evil and fun. Uses `Class.new`, my favorite Ruby method.

Muahahaha.

By Adam Keys

Telling a joke. Typing.

2 replies on “Fake Rails environment”

Comments are closed.