title: Need to loop through an array in rspec, test not running
body: <p>I have a test that needs to loop through 5 elements in an array then verify that all the elements are displayed as list items on the page. I have the code below, it's the last test with the comment '#get the first 5 blog posts'. When I run the tests, this test is not seen, because only 4 tests are getting executed. If I move the 'it {} ' statement outside the array code blog, the test becomes visible. How do I properly write this test so it can loop correctly?</p>
  
  <pre><code>require 'spec_helper'
  require 'requests/shared'
  
  describe "Header" do
  
      let (:title) { "my title" }
  
      subject { page }
  
      before { visit root_path }
  
      describe "Home" do
          it { should have_selector('title', text: title) }
          it { should have_selector('header') }
          it { should have_link 'Home', href: root_path}
  
  
          describe "Blog link exist" do
                  it { should have_link 'Blog'}
          end
  
          describe "Blog list elements" do
  
              #get the first 5 blog posts
              Blog.all(limit:5).each do |blog|    
                  it { should have_selector('ul.accordmobile li#blog ul li a', text: blog.title, href: blog_path(blog.id)) }
              end
          end 
  end
  </code></pre>
  
  <p>end</p>