This is slow - but it's what I've been doing...
# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/../spec_helper'
describe "Test basic sphinx settings for sphinx'd objects" do
before (:all) do
`rake ts:stop RAILS_ENV=development`
`rake ts:start RAILS_ENV=test`
`rake ts:index RAILS_ENV=test`
end
before do
assert ThinkingSphinx.sphinx_running?
end
[Article, Blog, BlogComment, Coach, Forum, Post, Topic, Forum, Video,
User].each do |obj|
it "should return something for '' search on #{obj.to_s}" do
assert obj.find(:all).size > 0
assert obj.search.size > 0
end
end
after (:all) do
`rake ts:stop RAILS_ENV=test`
`rake ts:start RAILS_ENV=development`
end
end
end
2009/7/9 Cássio Marques <[email protected]>
> Hello everybody,
> I'm trying to find a way to test some indexed models, but since I need to
> start/stop thinking-sphinx in my tests and due to the transactional nature
> of rspec tests, I'm having some problems. I think these problems are well
> known to many people, but I could not find a good solution for them through
> the internet. Basically, searches does not return anything at all inside my
> specs. Is there a proper way to set up TS stuff inside spec_helper?
>
> Thanks!
>
> --
> Cássio Marques
>
> Blog: http://cassiomarques.wordpress.com
>
> If you're writing code and you're not testing it, the code is wrong. I
> don't care if it does the right thing, and people need to understand this.
> If it works by accident, you're still wrong.
> Bryan Liles - Ruby Hoedown 2008
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---