require 'rubygems'
require 'active_record'
require File.join(File.dirname(__FILE__), '/../lib/has_translation')

module Rails
end

Spec::Runner.configure do |config|
  config.before do
    @fixtures_path = File.join(File.dirname(__FILE__), '/fixtures')
    Rails.stub!(:root).and_return(File.join(@fixtures_path, 'rails_root'))
    @locales_path = File.join(Rails.root, 'config/locales')
  end

  config.before(:each) do
    FileUtils.rm_rf(@locales_path)
    FileUtils.mkdir(@locales_path)
    I18n.default_locale = :en
    I18n.locale         = nil
    @load_translations  = lambda { I18n.load_path = Dir["#{@locales_path}/**/*.yml"]; I18n.reload! }
    @load_translations.call
  end
end
