Is there a way to reliably test the acts_as_ferret plugin using RoR
functional tests? I load my fixtures and no matter what I do, the test
won’t return a result for what should be a query that returns results.
Any help on this would be greatly appreciated.
FIXTURE
article_001:
id: 1
title: some valid article title
body: This is a valid article entry with
some images and stuff.
FUNCTIONAL TEST
def test_search
get :search, :q => “some valid article title”
assert_equal 1, assigns(:articles).size
end
On Fri, Dec 01, 2006 at 08:56:20PM +0100, Mark wrote:
Is there a way to reliably test the acts_as_ferret plugin using RoR
functional tests? I load my fixtures and no matter what I do, the test
won’t return a result for what should be a query that returns results.
Any help on this would be greatly appreciated.
the problem is, that fixtures aren’t loaded through active record, so no
ferret indexing can takes place. You have to call
Article.rebuild_index before running your tests (e.g. in setup), or
create your test data through active record inside your test case.
Jens
webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
On Fri, Dec 01, 2006 at 08:56:20PM +0100, Mark wrote:
Is there a way to reliably test the acts_as_ferret plugin using RoR
functional tests? I load my fixtures and no matter what I do, the test
won’t return a result for what should be a query that returns results.
Any help on this would be greatly appreciated.
the problem is, that fixtures aren’t loaded through active record, so no
ferret indexing can takes place. You have to call
Article.rebuild_index before running your tests (e.g. in setup), or
create your test data through active record inside your test case.
Right on Jens! That worked like a charm. I hadn’t originally considered
the fact that the fixtures aren’t loaded through ActiveRecord.
On Fri, Dec 01, 2006 at 08:56:20PM +0100, Mark wrote:
Is there a way to reliably test the acts_as_ferret plugin using RoR
functional tests? I load my fixtures and no matter what I do, the test
won’t return a result for what should be a query that returns results.
Any help on this would be greatly appreciated.
the problem is, that fixtures aren’t loaded through active record, so no
ferret indexing can takes place. You have to call
Article.rebuild_index before running your tests (e.g. in setup), or
create your test data through active record inside your test case.
Jens, is there a way to explicitly turn off ferret during testing except
for the functional tests where I want to test it?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.