title: Dynamic RSpec spec generation
body: <p>I'd like to generate a series of specs dynamically based on an external data source. Specifically, I have a Google Spreadsheet that's downloaded, and each row in the spreadsheet should be used for its own test case:</p>
  
  <pre><code>describe "Cases" do
    before(:all) do
      # Download spreadsheet and
      # populate cases in DB
    end
  
    Cases.each do |case|
      it "Case #{case.num}" do
        # spec
      end
    end
  end
  </code></pre>
  
  <p>This doesn't work, because, for starters with RSpec, doesn't (as I understand it) 'see' any specs at compile-time, so <code>before(:all)</code> is never executed. If I were to place an empty <code>it</code> block it'd get the <code>before(:all)</code> to execute, but then I'd run into the problem that <code>Cases.each</code> is evaluated before anything else, which is empty because it hasn't been populated yet by the <code>before(:all)</code> block.</p>
  
  <p>In short, I'm confused, and my understanding of RSpec appears very limited. I'd like to fetch data, use that data to set up a bunch of specs, and then have them run by RSpec. This would (might?) work if Cases were an array set up before-hand (outside the describe block), but I need it to be set up at runtime. Is what I want possible to do in RSpec?</p>