# Parameterising RSpec tests

**URL:** <https://www.ruby-forum.com/t/parameterising-rspec-tests/150589>\
**Category:** Ruby\
**Created:** [October 10, 2008, 8:40am UTC](https://www.ruby-forum.com/t/parameterising-rspec-tests/150589 "2008-10-10T08:40:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [October 10, 2008, 8:40am UTC](https://www.ruby-forum.com/t/parameterising-rspec-tests/150589/1 "2008-10-10T08:40:36Z")

</div>

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.
