[rspec-devel] Rails #8115 and spec/matchers/have

David Chelimsky dchelimsky at gmail.com
Thu Nov 8 12:29:30 EST 2007


On Nov 8, 2007 9:20 AM, Brandon Keepers <brandon at collectiveidea.com> wrote:
> Rails commit #8115 refactored how plugins are loaded and now adds all
> the vendor/plugins/*/lib directories to the load path before
> initializing all the plugins.
>
> rspec and rspec_on_rails both have spec/matchers/have.rb, and now that
> they're both in the load path, when rspec initializes and requires
> spec/matchers/have, the rspec_on_rails version gets loaded.
>
> This seems to only happen when I run integration tests and not specs
> (stack trace below).  The ways I see to fix this are 1) require these
> using an absolute path or 2) rename the rails one to spec/rails/
> matchers/have, or something along those lines.
>
> I'd be happy to submit a patch, let me know what you think about ways
> to get around this.

A patch would be awesome - thanks!

How about moving it from rspec_on_rails/lib/spec/matchers/have to
rspec_on_rails/lib/extensions/spec/matchers/have and include require
'spec/matchers/have' from within that file.

That file monkey patches Spec::Matchers::Have and I think putting
under an extensions directory makes sense.

WDYT?

>
> Brandon
>
>
>
>
>
> /Users/brandon/projects/dealerflow/vendor/plugins/rspec_on_rails/lib/
> spec/matchers/have.rb:4:in `alias_method': undefined method
> `failure_message' for class `Spec::Matchers::Have' (NameError)
>         from /Users/brandon/projects/dealerflow/vendor/plugins/rspec_on_rails/
> lib/spec/matchers/have.rb:4
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/1.8/rubygems/custom_require.rb:27:in `require'
>         from /Users/brandon/projects/dealerflow/vendor/rails/activerecord/
> lib/../../activesupport/lib/active_support/dependencies.rb:496:in
> `require'
>         from /Users/brandon/projects/dealerflow/vendor/rails/activerecord/
> lib/../../activesupport/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
>         from /Users/brandon/projects/dealerflow/vendor/rails/activerecord/
> lib/../../activesupport/lib/active_support/dependencies.rb:496:in
> `require'
>         from /Users/brandon/projects/dealerflow/vendor/plugins/rspec_on_rails/
> lib/spec/matchers.rb:3
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
>          ... 28 levels...
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb:5:in `load'
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb:5
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb:5:in `each'
>         from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
> ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb:5
> Errors running test:integration!
> ~/projects/dealerflow brandon$
>
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the rspec-devel mailing list