[Rspec-devel] run specs FAST with rails_spec

aslak hellesoy aslak.hellesoy at gmail.com
Tue Jul 4 10:59:57 EDT 2006

On 7/4/06, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> aslak hellesoy wrote:
> > In subversion I just added an additional feature to the rails stuff.
> > After doing a 'ruby script/generate rspec' you will have two new
> > files:
> This is REALLY exciting!  This was my #1 hope for rspec.  (#2 is
> integration testing, now that you're all freed up...)

We'll get there, but don't hold your breath for me to do it. It might
take some time. But I think it will be easy. Rails has an app() method
that gives straight access to most of the integration stuff.

> >
> > The latest gem doesn't have this code yet, so for now you will have to
> > do a rake package from svn and install the rspec and rspec_generators
> > from your file system.
> To spell that out, this seems to be:
> svn export svn://rubyforge.org//var/svn/rspec/trunk
> cd rspec/trunk
> rake package
> rake package_rails
> The rspec_generator is cleverly hidden in
> vendor/rspec_on_rails/vendor/generators/rspec/pkg.

Thanks for summarizing that Jay. This is the right process.
If you just want to hack on the stuff and improve it it's probably
better to stand in the demo rails app under vendor/rspec_on_rails. You
don't have to build the gem and install it from here.

> I installed both of these, and then installed the two gems.  I went back
> to my app and redid
> script/generate rspec
> I then ran the script/rails_spec_runner, and when it said "Ready", I ran
> "script/rails_spec spec" in another window.  The rails_spec_runner
> complained:
> /cygdrive/c/dev/src/eclipse/inventory/config/environment.rb:8: warning:
> already initialized constant RAILS_GEM_VERSION

I updated to the latest Rails version (1.1.4)

> Probably nothing.  The tests completed in no time!  But then I ran them
> again, and they all failed, with errors like:

I get a similar error running from the demo app. However it's the
model classes that aren't found - not the ficture ones:

$ script/rails_spec spec/models/person_spec.rb

NameError in 'The Person model should find an existing person'
uninitialized constant Person


> FixtureClassNotFound in 'The BBB receipt can handle adding the bunny
> slippers'
> The class "Receipt" was not found.
> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/fixtures.rb:403:in
> `find'
> ./spec/models/receipt_spec.rb:68:in `setup'
> script/rails_spec_runner:25:in `run'
> /usr/lib/ruby/1.8/drb/drb.rb:1552:in `perform_without_block'
> /usr/lib/ruby/1.8/drb/drb.rb:1512:in `perform'
> /usr/lib/ruby/1.8/drb/drb.rb:1586:in `main_loop'
> /usr/lib/ruby/1.8/drb/drb.rb:1582:in `main_loop'
> /usr/lib/ruby/1.8/drb/drb.rb:1578:in `main_loop'
> /usr/lib/ruby/1.8/drb/drb.rb:1427:in `run'
> /usr/lib/ruby/1.8/drb/drb.rb:1424:in `run'
> /usr/lib/ruby/1.8/drb/drb.rb:1344:in `initialize'
> /usr/lib/ruby/1.8/drb/drb.rb:1624:in `start_service'
> script/rails_spec_runner:46
> Finished in 0.341 seconds
> 32 specifications, 32 failures
> Did I miss a step, or is this a bug with rails_spec_runner's handling of
> fixtures?

This is definitely a bug, and it's not fixture specific. Nothing works
on a second run.
I don't know what's causing this yet.

And it needs to get fixed!


> >
> > Enjoy!
> >
> > Aslak
> > _______________________________________________
> > Rspec-devel mailing list
> > Rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the Rspec-devel mailing list