Sha256: 015c2048497af580f18753e11658b64b7eb04c829ae1d8cd956fdd92dbd33541

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

# This class is only used for testing purposes.
class FakeObject
  include ActiveModel::Validations

  def self.serialize(*) ; end
  def self.before_save(*) ; end

  attr_accessor :title_translations, :description_translations, :summary_translations

  # Has to be set in this context to test it correctly
  I18n.available_locales = [:en, :de, :'en-GB']

  def changes
    @changes ||= []
  end

  def mark_change(attribute)
    changes << attribute
  end

  def description_translations_will_change!
    mark_change :description_translations
  end

  def title_translations_will_change!
    mark_change :title_translations
  end

  def summary_translations_will_change!
    mark_change :summary_translations
  end

  include SerialTranslator
  serial_translator_for :title, :description, :summary
  validates :title,       serial_translator: { length: 5..25 }
  validates :description, serial_translator: { presence: true }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
serial_translator-0.0.9 spec/support/fake_object.rb
serial_translator-0.0.8 spec/support/fake_object.rb
serial_translator-0.0.7 spec/support/fake_object.rb
serial_translator-0.0.6 spec/support/fake_object.rb
serial_translator-0.0.5 spec/support/fake_object.rb