Sha256: 8fcb282d66987e36247cc7ace8b12ceac104b05c6301166ce2052a3ff802a24d

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'test/unit'
require 'i18n'
require 'i18n/backend/active_record'

require 'armot'
require 'logger'

ActiveRecord::Base.logger = Logger.new(nil)
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")

# Allow fallbacks to test production-like behaviour
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Fallbacks)
I18n.backend = I18n::Backend::ActiveRecord.new

def setup_db
  ActiveRecord::Migration.verbose = false
  load "schema.rb"
end

def teardown_db
  ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end

class Comment < ActiveRecord::Base
  armotize :msg
end

class Post < ActiveRecord::Base
  armotize :title, :text
  validates_presence_of :title
end

class Product < ActiveRecord::Base
  armotize :name

  def name=(value)
    super(value + " customized")
  end

  def self.find_by_name(value)
    "#{super(value).try(:name)}_override"
  end
end

# Puret translation model to test migration process
class PostTranslation < ActiveRecord::Base
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
armot-0.3.1 test/test_helper.rb
armot-0.3.0 test/test_helper.rb