promiscuous-io / promiscuous

Replicate data across your applications
396 stars 34 forks source link

Generating mocks for namespaced model isn't outputting parents in the publishers file #75

Open armyofgnomes opened 9 years ago

armyofgnomes commented 9 years ago

With a class like this, which is namespaced, but doesn't have any parent classes:

class SomeNamespace::OtherNamespace::ActualClass
  include Mongoid::Document
  include Mongoid::Timestamps
  include Promiscuous::Publisher

  field :value
end

will lead to just this in the publisher file when the mocks are generated:

  ...
  module SomeNamespace::OtherNamespace; end
  ...
  class SomeNamespace::OtherNamespace::ActualClass
    include Promiscuous::Publisher::Model::Mock
    mock :from => 'app'
    mock :id => :bson

    publish :value
  end

instead of

  ...
  module SomeNamespace; end
  module SomeNamespace::OtherNamespace; end
  ...
  class SomeNamespace::OtherNamespace::ActualClass
    include Promiscuous::Publisher::Model::Mock
    mock :from => 'app'
    mock :id => :bson

    publish :value
  end

I'm not sure if this is a bug in promiscuous or if the class was just written weird, since it doesn't really match any of the other classes we've done in the app.

kareemk commented 9 years ago

This looks like a bug. I'll see if I can push out a quick fix. Are you on the new-locking-scheme or kafka branch?

armyofgnomes commented 9 years ago

Kafka branch. Thanks Kareem!