Re: weirdness with ruby unit testing on mac



On 7/14/07, David Carlton <carlton@xxxxxxxxxxxx> wrote:
I have a ruby project that I've written in a Linux environment. (Ruby
1.8.5, on Ubuntu.) I'd like to work on it on my Mac (Ruby 1.8.2, OSX
10.4) while I'm on vacation, and something weird is happening with my
tests.

The project lives in a directory 'dbcdb' of my $RUBYLIB; there's a
subdirectory 'test', with a file 'all.rb' containing lines like this:

require 'dbcdb/test/test_author_printer'
require 'dbcdb/test/test_author_writer'
require 'dbcdb/test/test_book_writer'

Each of those test files defines a suite.

On the Linux box, if I do

ruby -e "require 'dbcdb/test/all'"

it runs all of them:

panini$ ruby -e "require 'dbcdb/test/all'"
Loaded suite -e
Started
......................................................................................................
Finished in 0.083742 seconds.

102 tests, 384 assertions, 0 failures, 0 errors

On the Mac, though, it does this:

truffle:~ carlton$ ruby -e "require 'dbcdb/test/all'"
Loaded suite .
Started

Finished in 0.000213 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

If I try to run one of the test files, it claims to run some tests:

truffle:~ carlton$ ruby -e "require 'dbcdb/test/test_author_printer'"
Loaded suite .
Started
....................................................................................................
Finished in 0.040504 seconds.

100 tests, 383 assertions, 0 failures, 0 errors

but that's equally bizarre since test_author_printer doesn't contain
100 tests.

What's going on here? Is there some difference between 1.8.2 and
1.8.5 that I'm unaware of, or something weird about the Mac ruby
installation, or what? If it's not something well-known, what's the
best way to debug the problem?

Thanks,
David Carlton
carlton@xxxxxxxxxxxx



First of all, you should be doing:
ruby dbcdb/test/all.rb
Not your wacky thing with -e and require. Dunno if that will fix it,
but it is standard practice this way.

--
Chris Carter
concentrationstudios.com
brynmawrcs.com

.



Relevant Pages

  • weirdness with ruby unit testing on mac
    ... I have a ruby project that I've written in a Linux environment. ... I'd like to work on it on my Mac (Ruby 1.8.2, ... Loaded suite -e ...
    (comp.lang.ruby)
  • Re: Need advice on Mac switching.
    ... I had heard of Ruby on Rails and good things about it, ... Ruby is a single-pass interpreted language. ... Any opinion on Dreamweaver? ... a Mac... ...
    (comp.sys.mac.advocacy)
  • Re: Draft chapter of RubyCocoa book
    ... you build Mac applications in Ruby. ... who've never used RubyCocoa. ... changing code and seeing what happens. ...
    (comp.lang.ruby)
  • Re: Pascal recommendation?
    ... Mac OS X comes with several scripting languages that would likely meet ... to Ruby and loved it. ... XCode is free, and you ...
    (comp.sys.mac.system)
  • libm libxml ruby-osa os x help
    ... I am trying to convert some of my nasty perl into nice neat ruby. ... The fink package fails as it tries to use ldconf (not a mac thing) while ... Libm on the mac I ...
    (comp.lang.ruby)