title: connection rejected from solr in Rspec
body: <p>I use the sunspot-rails for search. These is a Rspec looks like:</p>
  
  <pre><code>describe "GET search" do
    before(:all) do
      system("rake", "sunspot:solr:start")
    end
  
    after(:all) do
      system("rake", "sunspot:solr:stop")
    end
  
    it "should do some search" do
      Text.search do
        ...
      end
    end
  end
  </code></pre>
  
  <p>But it doesn't work. I got a failure:</p>
  
  <pre><code>Errno::ECONNREFUSED:
     Connection refused - connect(2)
  </code></pre>
  
  <p>But if I type <code>rake sunspot:solr:start RAILS_ENV=test</code> by hand in command line, and then run the spec, it passes.</p>
  
  <p>What's wrong? Isn't <code>rake sunspot:solr:start RAILS_ENV=test</code> equivalent to <code>system("rake", "sunspot:solr:start")</code> in test mode? </p>
  
  <p>(I tried `system("rake", "sunspot:solr:start RAILS_EVN=test"). Same.)</p>