[rspec-users] dynamic tests possible?

rogerdpack rogerpack2005 at gmail.com
Wed Aug 18 12:31:04 EDT 2010


Sorry if this is a newbie question, but here goes.

I was wondering if the following is somehow possible:


  for file in Dir['*.bmp']
    it "should be able to parse #{file}" do
      p file
      # test this file
    end
  end

Currently rspec seems to evaluate the blocks after the fact, leading
to "file" always being the last file in the list.
I was unsure how to pass a parameter into an "it" block.
Thoughts?
Thanks.
-r


More information about the rspec-users mailing list