Sha256: 5dd73317c7713095dd0c8ed5b7af4b0ead9ccc087043fc41aed24630b298a1ad

Contents?: true

Size: 628 Bytes

Versions: 39

Compression:

Stored size: 628 Bytes

Contents

# This class was made to help test class agnostic engine functionality that
# requires model interfaces to work.
#
# An example would be tests for polymorphic associations:
#   foo = Udongo::BogusModel.new(id: 37, description: 'foobar', hidden?: false)
#   create(:search_index, searchable: foo, locale: 'nl')
class Udongo::BogusModel < OpenStruct
  attr_reader :id

  def self.base_class
    self.class
  end

  def self.primary_key
    :id
  end

  def _read_attribute(attribute)
    nil
  end

  def id
    @id = rand(1..1000) unless @id
    @id
  end

  def destroyed?
    false
  end

  def new_record?
    false
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
udongo-7.9.0 lib/udongo/bogus_model.rb
udongo-7.8.1 lib/udongo/bogus_model.rb
udongo-7.8.0 lib/udongo/bogus_model.rb
udongo-7.7.2 lib/udongo/bogus_model.rb
udongo-7.7.1 lib/udongo/bogus_model.rb
udongo-7.7.0 lib/udongo/bogus_model.rb
udongo-7.6.2 lib/udongo/bogus_model.rb
udongo-7.6.1 lib/udongo/bogus_model.rb
udongo-7.6.0 lib/udongo/bogus_model.rb
udongo-7.5.1 lib/udongo/bogus_model.rb
udongo-7.5.0 lib/udongo/bogus_model.rb
udongo-7.4.2 lib/udongo/bogus_model.rb
udongo-7.4.1 lib/udongo/bogus_model.rb
udongo-7.4.0 lib/udongo/bogus_model.rb
udongo-7.3.5 lib/udongo/bogus_model.rb
udongo-7.3.4 lib/udongo/bogus_model.rb
udongo-7.3.3 lib/udongo/bogus_model.rb
udongo-7.3.2 lib/udongo/bogus_model.rb
udongo-7.3.1 lib/udongo/bogus_model.rb
udongo-7.2.1 lib/udongo/bogus_model.rb