# Formatting the test result in Spec

**URL:** <https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637>\
**Category:** IronRuby\
**Created:** [July 6, 2009, 10:23pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637 "2009-07-06T22:23:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 10:23pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/1 "2009-07-06T22:23:43Z")

</div>

I got the Spec working in IronRuby! Thanks everyone.

How can I get a detailed report (command line) when running the test?

Currently, I only get the following:

C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite\>ir  
test\_prime.rb  
Loaded suite test\_prime  
Started

Finished in 0.015625 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

Also, for some reason it says “0 tests” here is my test\_prime.rb file:

require ‘test/unit’  
require ‘rubygems’  
require ‘spec’

require File.dirname( **FILE** ) + ‘/bin/Debug/BusinessObjects.dll’

include BusinessObjects  
include Test::Unit

describe PrimeService,“when 1 is passed to the prime service” do

it “should return true” do

primeService = PrimeService.new  
primeService.IsPrime(1)

end

end

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 10:32pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/2 "2009-07-06T22:32:14Z")

</div>

I changed the code to this but still not picking up the test:

describe PrimeService,“when 1 is passed to the prime service” do

it “should return true” do

primeService = PrimeService.new  
primeService.IsPrime(1).should == true

end

Mohammad A. wrote:

> I got the Spec working in IronRuby! Thanks everyone.
> 
> How can I get a detailed report (command line) when running the test?
> 
> Currently, I only get the following:
> 
> C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite\>ir  
> test\_prime.rb  
> Loaded suite test\_prime  
> Started
> 
> Finished in 0.015625 seconds.
> 
> 0 tests, 0 assertions, 0 failures, 0 errors
> 
> Also, for some reason it says “0 tests” here is my test\_prime.rb file:
> 
> require ‘test/unit’  
> require ‘rubygems’  
> require ‘spec’
> 
> require File.dirname( **FILE** ) + ‘/bin/Debug/BusinessObjects.dll’
> 
> include BusinessObjects  
> include Test::Unit
> 
> describe PrimeService,“when 1 is passed to the prime service” do
> 
> it “should return true” do
> 
> primeService = PrimeService.new  
> primeService.IsPrime(1)
> 
> end
> 
> end

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 10:52pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/3 "2009-07-06T22:52:23Z")

</div>

I had to configure the path for spec.bat using environment variables.

Now, I can run the specifications using the following:

spec test\_prime.rb

but I still need to format is nicely. --format nested does not work it  
complains that invalid --format parameter!

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 11:03pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/4 "2009-07-06T23:03:16Z")

</div>

You are right!

require test/unit was the problem. I removed it and it worked smoothly!

Thanks,  
Azam

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 11:01pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/5 "2009-07-06T23:01:18Z")

</div>

Mohammad A. wrote:

> I had to configure the path for spec.bat using environment variables.
> 
> Now, I can run the specifications using the following:
> 
> spec test\_prime.rb
> 
> but I still need to format is nicely. --format nested does not work it  
> complains that invalid --format parameter!

Have you removed the test/unit require so that the test/unit runner data  
isn’t coming back? I think that was a red herring earlier in your post.

Here’s the command I ran (full path to make sure I was running the right  
spec.bat):

C:\OSS\ironruby\Merlin\Main\Bin\debug\spec.bat test.rb --format specdoc

I got back the following output (from a script similar to yours):

Some Simple assert

- should show that 1 is equal to 1

Finished in 0.2343855 seconds

1 example, 0 failures

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 6, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/formatting-the-test-result-in-spec/171637/6 "2009-07-06T23:10:49Z")

</div>

One other thing I noticed is that I have already installed win32console  
gem on my machine but for some reason whenever I use the color option it  
gives me the following output:

C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite\>spec  
test\_prime.rb  
–format specdoc --colour  
You must ‘gem install win32console’ to use colour on Windows

BusinessObjects::PrimeService when foo method is called

- should return true

Finished in 0.265625 seconds

1 example, 0 failures

Thanks,  
Azam
