Sha256: 58bff02bf2491ce6adbe000555468036122a316bb5d0f6a629e42d3b8bbf82c0

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

require 'vedeu/repositories/model'
require 'vedeu/output/presentation'

module Vedeu

  module RepositoryTestModule

    extend self

    def by_name(name)
      model
    end

    # The real repository stores the model and returns it.
    def store(model)
      model
    end

    private

    # A storage solution that uses memory to persist models.
    def in_memory
      {}
    end

  end # RepositoryTestModule

  class ModelTestClass

    include Vedeu::Model
    include Vedeu::Presentation

    attr_accessor :background, :colour, :name, :style

    def initialize(attributes = {})
      @attributes = defaults.merge!(attributes)

      @attributes.each { |key, value| instance_variable_set("@#{key}", value) }
    end

    private

    def defaults
      {
        colour:     {},
        name:       '',
        repository: Vedeu::RepositoryTestModule,
        style:      [],
      }
    end

  end # ModelTestClass

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.4.44 test/support/helpers/model_test_class.rb
vedeu-0.4.43 test/support/helpers/model_test_class.rb
vedeu-0.4.42 test/support/helpers/model_test_class.rb
vedeu-0.4.41 test/support/helpers/model_test_class.rb
vedeu-0.4.40 test/support/helpers/model_test_class.rb