I have a rspec class with set of tests. I want to run the same rspec test class multiple time with different parameters. Is it possible in rspec? If so, can someone help me with an example.
describe 'run test' do
param = ''
it 'xyz' do
...
puts param
...
end
it 'abc' do
...
puts param
...
end
end
So, I want to run this rspec class multiple times with different values of param.
Thanks in advance.
答案 0 :(得分:4)
spec files are just ruby files so you can just wrap them around in a block if you have a fixed set of param values. The following code should run ok.
1.upto(5) do |num|
describe 'test' do
it { expect(num).not_to eq(0) }
end
end