Sha256: fae0d59ac5f8d3eaacb50d762f8146c8cf87bdda107f61b43f4e4654665fe06d

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

require 'test_setup'

I18n::Tests.parse_options!
require 'bundler/setup'
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
require 'i18n/active_record'
require 'i18n/tests'
require 'mocha'
I18n::Tests.setup_active_record

class Test::Unit::TestCase
  def self.test(name, &block)
    test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
    defined = instance_method(test_name) rescue false
    raise "#{test_name} is already defined in #{self}" if defined
    if block_given?
      define_method(test_name, &block)
    else
      define_method(test_name) do
        flunk "No implementation provided for #{name}"
      end
    end
  end

  def self.with_mocha
    yield if Object.respond_to?(:expects)
  end

  def teardown
    I18n.locale = nil
    I18n.default_locale = :en
    I18n.load_path = []
    I18n.available_locales = nil
    I18n.backend = nil
  end

  def translations
    I18n.backend.instance_variable_get(:@translations)
  end

  def store_translations(*args)
    data   = args.pop
    locale = args.pop || :en
    I18n.backend.store_translations(locale, data)
  end

  def locales_dir
    File.dirname(__FILE__) + '/test_data/locales'
  end
end

Object.class_eval do
  def meta_class
    class << self; self; end
  end
end unless Object.method_defined?(:meta_class)

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
chipairon-i18n-active_record-0.0.4 test/test_helper.rb
chipairon-i18n-active_record-0.0.3 test/test_helper.rb
chipairon-i18n-active_record-0.0.2 test/test_helper.rb
arena-i18n-active_record-0.0.4 test/test_helper.rb
arena-i18n-active_record-0.0.333 test/test_helper.rb
i18n-active_record-0.0.2 test/test_helper.rb