Parameterising RSpec tests

D

David Mitchell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top