Fake Rails environment
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.
For testing some bits inside of ActiveRecord proper.
Evil and fun. Uses `Class.new`, my favorite Ruby method.
Muahahaha.
But you can do it without the Class.new:
o = Object.new
def o.production?() true end
o
Well done. But, I say, what’s the fun in that? ;)
© The Real Adam. Powered by WordPress using a gently tweaked DePo Clean Theme.
2 Comments