small medium large xlarge

Generic-user-small
01 Dec 2010, 04:55
Wayne Johnson (4 posts)

I am trying to do this using rspec 2.2. I did as suggested on page 18, created the file autotest/.autotest/discover.rb and added the suggest line. Auto test still does not seem to pick up the fact the I am using rspec. I ran autotest -v and I see that autotest detects the changes to the file but the output indicates that it could not find any tests.

I have spent an hour or so with Google and have tried other things including creating ~/.autotest and adding the same lines. I have also tried setting RSPEC=true before running autotest. I also tried uninstalling ZenTest and installing autotest instead but I got the same results:

‘No tests matched …’ for the files in the tree.

OS X 10.6.5 ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] ZenTest (4.4.0) rspec (2.2.0)

Thanks

Generic-user-small
01 Dec 2010, 04:57
Wayne Johnson (4 posts)

I forgot to mention that ‘rake spec’ works as expected.

Wayne

Generic-user-small
01 Dec 2010, 05:10
Wayne Johnson (4 posts)

Of course after posting it only took me about 5 minutes to figure out the either I misread the the instructions or there is a typo. The text says “create a directory tree in the root of your project named autotest/.autotest.” But I think it should simply say “create a directory tree in the root of your project named autotest/.” If I put discover.rb in this directory it tries to run the tests. But now I have run but it looks like an exceptions gets thrown:

“lib/ruby/1.8/optparse.rb:1450:in `complete’: invalid option: –tty (OptionParser::InvalidOption)”

Generic-user-small
08 Dec 2010, 05:21
Michelle Pace (1 post)

Hello,

I also can not get the instructions on page 18 (ie making Rspec to use autospec) to work. I am using windows XP. Please see details below:

C:\DEVELOPMENT\twits>ls Gemfile LICENSE.txt README.rdoc Rakefile autotest lib spec

C:\DEVELOPMENT\twits>cat autotest/discover.rb Autotest.add_discovery { “rspec2” }

C:\DEVELOPMENT\twits>ruby -v ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\DEVELOPMENT\twits>gem list –local

** LOCAL GEMS **

autotest (4.4.6) bundler (1.0.7) diff-lcs (1.1.2) git (1.2.5) jeweler (1.5.1) minitest (1.6.0) rake (0.8.7) rdiscount (1.6.5) rdoc (2.5.8) redcar (0.9.1) rspec (2.2.0) rspec-core (2.2.1) rspec-expectations (2.2.0) rspec-mocks (2.2.0) rubyzip (0.9.4) ZenTest (4.4.1)

C:\DEVELOPMENT\twits>autospec ******************** REMOVAL NOTICE: you are using behaviour that has been removed from rspec-2.

  • The ‘autospec’ command is no longer supported.
  • Please use ‘autotest’ insted.

This message will be removed from a future version of rspec. ********************

cheers, Michelle

Benrady-avatar_pragsmall
27 Dec 2010, 18:55
Ben Rady (67 posts)

The examples in the book are currently written against RSpec 1.x. The autospec command was removed from RSpec 2, and we’re probably going to have to convert the examples in the book to RSpec 2.

Generic-user-small
08 Jan 2011, 01:47
Toby Joiner (3 posts)

Is the comment you added about Rspec 2 supposed to fix the problem? If so I am having issues with it. If not, I will wait for the fixes. Thanks for the book =)

Photo on 2011-02-04_pragsmall
27 Mar 2011, 13:20
Nicholas Cancelliere (2 posts)

I’m having the same issue with Rails 3, Rspec 2.5.0 and autotest 4.4.6. I’ve tried the autotest/discover.rb trick, edited ~/.autotest, etc. Nothing works, so I’m just moving on at this point. I hope they fix it in the future to be as easy as ‘autospec’ was – the test just worked. All this per-project tweaks and setup for discovery doesn’t feel like convention over configuration.

Photo on 2011-02-04_pragsmall
27 Mar 2011, 14:50
Nicholas Cancelliere (2 posts)

Figured out in the meantime you can use ‘autotest -s rsepc2’

Benrady-avatar_pragsmall
11 May 2011, 03:39
Ben Rady (67 posts)

Simply adding an .rspec config file in the root of the project will give you the behavior that you want. The final version of the book will explain this in detail.

You must be logged in to comment