Module: Shoegaze::Datastore

Defined in:
lib/shoegaze/datastore.rb

Instance Method Summary collapse

Instance Method Details

#datastore(name, &block) ⇒ Class

Defines both a TopModel-inherited class and a factory in the mock namespace

example:

datastore :User do
  id 123
  name "Karlita"
end

16
17
18
19
20
21
22
23
24
25
26
# File 'lib/shoegaze/datastore.rb', line 16

def datastore(name, &block)
  klass = create_datastore_class(name)

  FactoryGirl.define do
    factory klass do
      self.instance_eval(&block)
    end
  end

  klass
end