On Mon, Mar 17, 2008 at 10:44 AM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> On 17/03/2008, Ashley Moran <[EMAIL PROTECTED]> wrote:
> > Has anyone managed this?
> >
>
> Cracked it.  Really ugly, but my stories/helper.rb looks like this
>
>   ENV["RAILS_ENV"] = "test_integration"
>   require File.expand_path(File.dirname(__FILE__) +
> "/../config/environment")
>    # We don't want to use the story adapter because it interferes
>   # starts creating transactions that stop multi-process testing (ie
>   # story runner and mongrel) seeing each other's data
>   #require 'spec/rails/story_adapter'
>
>   # ...
>
>   # Hack to let us use should have_tag without loading rspec_on_rails
>   module ActionController
>     class TestResponse
>
>     end
>   end
>
>   include Test::Unit::Assertions
>
>   require 'action_controller/assertions'
>    include ActionController::Assertions
>
>   require 'spec/rails/matchers/assert_select'
>   include Spec::Rails::Matchers
>
> It's just waiting to break, I know it.
>
> Actually having done this and discussed assert_select with my team, I think
> I'll write a have_tag matcher using Hpricot.  That way I'm not putting the
> quality of our application in the hands of Rails code.
>
> I thought I'd post this anyway for reference.
>
> Ashley

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
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to