On Tue, Mar 18, 2008 at 9:04 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > On 17/03/2008, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > > We discussed this in a ticket on lighthouse, and I ended up writing a > > workalike that's sitting atop hpricot. It's not quite identical, but > > generally close enough and so far does everything I've needed: > > > > http://github.com/pd/rspec_hpricot_matchers > > > > Patches and/or suggestions welcome if you need anything else out of it > > > > Kyle > > Hi Kyle > > Really impressed with that! Seems to be working ok in our app, only > starting to use it though. Here's how I got it working in Rails:
I personally just toss things into vendor/gems, and add something along these lines to environment.rb: config.load_paths += Dir[File.join('vendor', 'gems', '*', 'lib')].map do |libdir| File.expand_path(libdir) end This'll let it be loaded as a gem and you can put this in spec_helper: require 'rspec_hpricot_matchers' Spec::Runner.configure do |config| config.include(RspecHpricotMatchers) end I really like your undef magic for disabling the rspec_on_rails matchers; hadn't thought of doing that. One problem you will run into, I'm sure, is nested expectation failure messages: body.should have_tag('ul') do |ul| ul.should have_tag('li') end Fails with "expected body to have tag 'ul'", even if it's the inner 'li' that was missing. I haven't come up with a good way to fix this, but it's very annoying! Kyle _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users