Sha256: a6fe71e01857a8a0526e91e7a8596055ae7e03a5f1fd3444e65a8171a1512df5

Contents?: true

Size: 388 Bytes

Versions: 17

Compression:

Stored size: 388 Bytes

Contents

module Pickle
  class Migrant < Adapter
    def self.factories
      model_classes.select { |model| model.respond_to?(:mock) }.collect { |model| new(model) }
    end
    
    def initialize(klass)
      @klass, @name = klass, klass.name.underscore.gsub('/', '_')
    end
    
    def create(attrs={})
      @klass.mock!(Hash[attrs.collect { |k,v| [k.to_sym, v] }])    
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
migrant-2.0.0 lib/pickle/migrant.rb
migrant-2.0.0.pre lib/pickle/migrant.rb
migrant-1.5.0 lib/pickle/migrant.rb
migrant-1.4.3 lib/pickle/migrant.rb
migrant-1.4.1 lib/pickle/migrant.rb
migrant-1.4.0 lib/pickle/migrant.rb
migrant-1.3.2 lib/pickle/migrant.rb
migrant-1.3.1 lib/pickle/migrant.rb
migrant-1.3.0 lib/pickle/migrant.rb
migrant-1.2.8 lib/pickle/migrant.rb
migrant-1.2.7 lib/pickle/migrant.rb
migrant-1.2.5 lib/pickle/migrant.rb
migrant-1.2.2 lib/pickle/migrant.rb
migrant-1.2.1 lib/pickle/migrant.rb
migrant-1.2.0 lib/pickle/migrant.rb
migrant-1.1.2 lib/pickle/migrant.rb
migrant-1.1.1 lib/pickle/migrant.rb