How to write a test for Ultrasphinx

Hi All,

I have the ultrasphinx plugin installed and it is working fine, but I’d
like to write some tests for it.

I have tried putting this test in one of my unit tests:

def test_should_run_ultrasphinx_query
@results = Ultrasphinx::Search.new(:query => “Second”).run.results
assert_equal @results.first.headline, “Second Story”
end

With a fixture properly defined for the model being searched… but the
test errors out.

The error I’m getting is:

NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.headline (so, the results set
comes back as empty).

Anyway, I’m wondering if there is any weirdness to how I have to set up
test/unit to make it work.

the daemon IS running… If I try the same search in a console, it
doesn’t run there either (in the test environment - script/console
test). But, the results set does come back in development
environment…

Do I need config/ultrasphinx/test.conf ? I have development.conf in
there, but I’m not sure how to generate test.conf?

Thanks,
Dustin

Hey All, FYI - here’s what we ended up using to test ultrasphinx

http://stephencelis.com/archive/2008/4/testing-with-ultrasphinx/