[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Parameterising RSpec tests

David Mitchell

10/10/2008 6:38:00 AM

Hello everyone,

I'm trying to work out how to use RSpec to bundle up some existing
test cases (created with a tool that is so nasty it defies
description). For reasons that I won't go into, I'm stuck with using
the test cases that have been generated with this (non-Ruby) tool, but
I've managed to wrap the execution of individual test cases in a Ruby
class that makes them somewhat easier to work with:

class Test
def execute_test(test_id)
...
end

def test_passed?
...
end
end

All this works OK now.

What I'd like to have is something like:

describe 'The shakeout test suite' do
it 'should complete test case 47 successfully'
it 'should complete test case 173 successfully'
it 'should complete test case 957 successfully'
end

then have

describe 'should complete test case #{some_number} successfully' do
m = Test.new()
m.execute_test(#{some_number})
...
end


Is there some elegant way to parameterise RSpec test "describes" in this manner?

Regards

Dave M.