Loading rails 2.3 / 3+ in your gem tests

In case you want to test your gem / plugin on multiple rails version:

require 'rails/version'

if Rails::VERSION::MAJOR > 2
  require 'rails'
else
  module Rails
    class FakeConfig
      def after_initialize
      end
    end
    @@configuration = FakeConfig.new
  end
  require 'initializer'
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s