Forum: Ruby Testing Gems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9c7f2f44463d1d4890f73e8a8229dd29?d=identicon&s=25 Caleb Tennis (Guest)
on 2006-01-11 14:46
(Received via mailing list)
According to http://docs.rubygems.org/read/chapter/20#test_files, the
test_files section of the gemspec file lists test files that are loaded
"when
the user requests a gem to be unit tested".

Is there a gem command to run the tests?  I can't see one listed in the
help,
but I may just be missing it.

Caleb
Cd49db0b676767ea4358b1047c4cddd2?d=identicon&s=25 Robin Stocker (Guest)
on 2006-01-11 15:17
(Received via mailing list)
Hi,

I recently had exactly the same question... So, maybe the Gemspec
Reference should be updated.

The install command has the --test or -t option.
Have a look at gem help install.

So, for example:
gem install examplegem --test

   Robin
82e62c756d89bc6fa0a0a2d7f2b1e617?d=identicon&s=25 Ross Bamford (Guest)
on 2006-01-11 15:20
(Received via mailing list)
On Wed, 11 Jan 2006 13:45:04 -0000, Caleb Tennis <caleb@aei-tech.com>
wrote:

> According to http://docs.rubygems.org/read/chapter/20#test_files, the
> test_files section of the gemspec file lists test files that are loaded
> "when
> the user requests a gem to be unit tested".
>
> Is there a gem command to run the tests?  I can't see one listed in the
> help,
> but I may just be missing it.
>

Try something like:

	$ gem install --test somegem

There is detail with:

	$ gem help install
	$ gem help examples

If the tests succeed, there's no output (at least by default?) but they
do
run if they're there (after Rdoc I think).

Cheers,
52a177e9dbd3e614825aabc4e45f8cd6?d=identicon&s=25 Mark Volkmann (Guest)
on 2006-01-11 15:23
(Received via mailing list)
On 1/11/06, Robin Stocker <robin@nibor.org> wrote:
> Hi,
>
> I recently had exactly the same question... So, maybe the Gemspec
> Reference should be updated.
>
> The install command has the --test or -t option.
> Have a look at gem help install.
>
> So, for example:
> gem install examplegem --test

Interesting thing about running the tests this way ...
If the gem has no tests, it outputs "There are no unit tests to run".
If any tests fail, it prompts whether to keep the gem.
If no tests fail, there is no output and no indication that tests were
run.

I don't really like that last part. I wish there was some output
indicating that the tests were actually run.
This topic is locked and can not be replied to.