Sha256: 79281a8099341a191886ba16db9836603319229ea079c921dbf8e5ee34e20f54

Contents?: true

Size: 401 Bytes

Versions: 9

Compression:

Stored size: 401 Bytes

Contents

module ModelHelpers
  def stub_model(name = nil, superclass = nil, &block)
    stub_class(name, superclass) { include ActiveData::Model }.tap { |klass| klass.class_eval(&block) if block }
  end

  def stub_class(name = nil, superclass = nil, &block)
    klass = superclass ? Class.new(superclass, &block) : Class.new(&block)
    name.present? ? stub_const(name.to_s.camelize, klass) : klass
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_data-1.2.0 spec/support/model_helpers.rb
active_data-1.1.7 spec/support/model_helpers.rb
active_data-1.1.6 spec/support/model_helpers.rb
active_data-1.1.5 spec/support/model_helpers.rb
active_data-1.1.4 spec/support/model_helpers.rb
active_data-1.1.3 spec/support/model_helpers.rb
active_data-1.1.2 spec/support/model_helpers.rb
active_data-1.1.1 spec/support/model_helpers.rb
active_data-1.1.0 spec/support/model_helpers.rb