[rspec-users] Migrating spec_helper with modifications

David Chelimsky dchelimsky at gmail.com
Mon Apr 30 15:53:22 EDT 2007


On 4/30/07, Chris Hoffman <chris.c.hoffman at gmail.com> wrote:
> Okay, I got it working with the following:
>
> Spec::Runner.configure do |config|
>   config.use_transactional_fixtures = true
>   config.use_instantiated_fixtures  = false
>   config.fixture_path = RAILS_ROOT + '/spec/fixtures'
>   Spec::DSL::Behaviour.send(:include, Breakpoint)
>   Spec::DSL::Behaviour.send(:include, HpricotSpecHelper)
> end
>
> I couldn't call include directly, as it's a private method.
>
> Should I be using this mailing list for these HEAD issues, or is there
> a better place?

As long as  you have a workaround, go ahead and use that for now. I'll
get the support for config.include in place in the next day or so -
possibly even today.

rspec-devel is probably better, but this list is fine. Lots of
trunksters on this list.

Cheers,
David

>
> -Chris
>
> On 4/30/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> > On 4/30/07, Chris Hoffman <chris.c.hoffman at gmail.com> wrote:
> > > That doesn't seem to work for me:
> > >
> > > Spec::Runner.configure do |config|
> > >   config.use_transactional_fixtures = true
> > >   config.use_instantiated_fixtures  = false
> > >   config.fixture_path = RAILS_ROOT + '/spec/fixtures'
> > >   config.include Breakpoint
> > > end
> > >
> > > Gives me an undefined method 'include'
> > >
> > > ./spec/models/../spec_helper.rb:13: undefined method `include' for
> > > #<Spec::DSL::Configuration:0xb6f4822c> (NoMethodError)
> >
> > UGH - that was the intent - I have to add that.
> >
> > In the mean time, you can use Spec::DSL::Behaviour.include - but that
> > is subject to change. That's just what it is today. I'll follow up
> > when I add config.include.
> >
> > Cheers,
> > David
> >
> >
> > >
> > > -Chris
> > >
> > > On 4/30/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> > > > On 4/30/07, Chris Hoffman <chris.c.hoffman at gmail.com> wrote:
> > > > > Hello,
> > > > >
> > > > > After moving into the HEAD of rspec, I am greeted with a mountain of errors,
> > > > > which I expected, due to my specs not being migrated.
> > > > >
> > > > > I use hpricot for a lot of my view tests, as it is extremely simple to
> > > > > traverse the DOM with it.  I used to include HpricotSpecHelper in
> > > > > spec_helper.rb, like so:
> > > > >
> > > > > require 'hpricot_spec_helper'
> > > > >
> > > > > module Spec
> > > > >   module Rails
> > > > >     module Runner
> > > > >       class EvalContext < Test::Unit::TestCase
> > > > >         include HpricotSpecHelper
> > > > >       end
> > > > >     end
> > > > >    end
> > > > > end
> > > > >
> > > > > However, I am now getting errors that indicate that this inclusion no longer
> > > > > does what I want.  Is there a different class in which I should be including
> > > > > this module?
> > > > >
> > > > > The errors I'm getting are of the following type:
> > > > >
> > > > > undefined method `elements' for
> > > > > #<#<Class:0xb6f12a14>:0xb6eb8ff0>
> > > > >
> > > > > element(s) is a top-level method, so I would do things like the following:
> > > > >
> > > > > element("p").inner_text.should == "Hello World"
> > > > >
> > > > > The following link shows HpricotSpecHelper (with syntax highlighting):
> > > > >
> > > > > http://src.chrishoffman.net/lib/hpricot_spec_helper.rb
> > > > >
> > > > > Please let me know if I am not being clear with my difficulty.  Thanks for
> > > > > the help.
> > > >
> > > > The easy way to include modules now is like this:
> > > >
> > > > Spec::Runner.configure do |config|
> > > >   config.include SomeModule
> > > > end
> > > >
> > > > That gets included in every behaviour.
> > > >
> > > > That help?
> > > >
> > > > >
> > > > > -Chris
> > > > >
> > > > > _______________________________________________
> > > > > rspec-users mailing list
> > > > > rspec-users at rubyforge.org
> > > > > http://rubyforge.org/mailman/listinfo/rspec-users
> > > > >
> > > > _______________________________________________
> > > > rspec-users mailing list
> > > > rspec-users at rubyforge.org
> > > > http://rubyforge.org/mailman/listinfo/rspec-users
> > > >
> > > _______________________________________________
> > > rspec-users mailing list
> > > rspec-users at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rspec-users
> > >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list