Exception raised when loading Shoulda matchers with factory_girl 2.0+ #586

Closed
msheakoski opened this Issue Sep 3, 2011 · 0 comments

Comments

Projects
None yet
2 participants

In the file https://github.com/thoughtbot/paperclip/blob/master/shoulda_macros/paperclip.rb#L112-114 paperclip tries to include its macros into the Factory class, which is now a proxy in factory_girl 2.0+, and results in an exception being raised.

class Factory
  include Paperclip::Shoulda  #:nodoc:
end

The fix is to change it to something like:

if defined?(FactoryGirl::Factory)
  class FactoryGirl::Factory
    include Paperclip::Shoulda  #:nodoc:
  end
else
  class Factory
    include Paperclip::Shoulda  #:nodoc:
  end
end

@sikachu sikachu closed this in d639d5e Sep 4, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment