I use the sunspot-rails for search. These is a Rspec looks like:
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
But it doesn't work. I got a failure:
Errno::ECONNREFUSED:
Connection refused - connect(2)
But if I type rake sunspot:solr:start RAILS_ENV=test
by hand in command line, and then run the spec, it passes.
What's wrong? Isn't rake sunspot:solr:start RAILS_ENV=test
equivalent to system("rake", "sunspot:solr:start")
in test mode?
(I tried `system("rake", "sunspot:solr:start RAILS_EVN=test"). Same.)