Have matcher fails when ActiveSupport partially loaded #30

Closed
cgriego opened this Issue Oct 12, 2010 · 3 comments

2 participants

@cgriego

The Have matcher checks for the definition of ActiveSupport::Inflector when evaluating the matching, and assumes that if ActiveSupport::Inflector is defined that it responds to pluralize. ActiveSupport 3.0 can be partially loaded so that ActiveSupport::Inflector is defined but does not respond to pluralize because inflector/methods.rb has been loaded but inflector/inflections.rb has not. I've done this in a gem I'm developing by cherry picking active_support/dependencies/autoload which requires active_support/inflector/methods but not active_support/inflector/inflections

@txus

Giving it a try on my inflectors branch: http://github.com/txus/rspec-expectations/tree/inflectors
I'll try to find some time tonight and get it finished.

@txus

Ok, this should be it. Added the additional check so that RSpec does not try to pluralize unless inflector indeed responds to :pluralize.

http://github.com/txus/rspec-expectations/commit/34a4296f295ca68fa1f1264b9222c8c3a2134f98

@txus

have_matcher - use pluralize only when ActiveSupport inflections are indeed defined

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