Figured out the problem, and it was, predictably, something stupid on
my part.  I had a searchd running, so the features tried to use it and
couldn't find anything since it was holding different indices.
Killing that instance allowed the features to run properly.

Is there a way to either 1) warn when running features if an existing
searchd is running or 2) run the features searchd on a different port?

On Mar 3, 12:01 pm, Jeffrey Chupp <[email protected]> wrote:
> OK, I'm on the right track now, but the rake features:mysql fails
> (before any of my changes, I should note).  I can run rake spec fine
> and ruby contribute.rb also went fine.  The problem seems to be that
> no index is being built as the failures are mostly like this:
>
>     Then I should get 1 result                           # features/
> step_definitions/common_steps.rb:135
>       expected: 1,
>            got: 0 (using ==)
>       Diff:
>       @@ -1,2 +1,2 @@
>       -1
>       +0 (Spec::Expectations::ExpectationNotMetError)
>       ./features/step_definitions/common_steps.rb:136:in `Then /^I
> should get (\d+) results?$/'
>       features/searching_with_find_arguments.feature:41:in `Then I
> should get 1 result'
>
> although occasionally they look like this:
>
> Then I should get 1 result                                           #
> features/step_definitions/common_steps.rb:135
>       undefined method `constantize' for nil:NilClass (NoMethodError)
>       ./features/support/../../lib/thinking_sphinx/collection.rb:
> 100:in `class_from_crc'
>       ./features/support/../../lib/thinking_sphinx/collection.rb:79:in
> `instances_from_classes'
>       ./features/support/../../lib/thinking_sphinx/collection.rb:77:in
> `each'
>       ./features/support/../../lib/thinking_sphinx/collection.rb:77:in
> `instances_from_classes'
>       ./features/support/../../lib/thinking_sphinx/collection.rb:39:in
> `instances_from_matches'
>       ./features/support/../../lib/thinking_sphinx/collection.rb:31:in
> `create_from_results'
>       ./features/support/../../lib/thinking_sphinx/search.rb:293:in
> `search'
>       ./features/support/../../lib/thinking_sphinx/search.rb:308:in
> `call'
>       ./features/support/../../lib/thinking_sphinx/search.rb:308:in
> `retry_search_on_stale_index'
>       ./features/support/../../lib/thinking_sphinx/search.rb:283:in
> `search'
>       ./features/step_definitions/common_steps.rb:144:in `send'
>       ./features/step_definitions/common_steps.rb:144:in `results'
>       ./features/step_definitions/common_steps.rb:136:in `Then /^I
> should get (\d+) results?$/'
>       features/searching_with_find_arguments.feature:51:in `Then I
> should get 1 result'
>
> any advice?
>
> On Mar 3, 8:01 am, Jeffrey Chupp <[email protected]> wrote:
>
>
>
> > Pat, thanks!  You've cleared up some of the mystery of the specs setup
> > for me.  I'll implement my test as a feature.
>
> > On Mar 3, 2:21 am, Pat Allan <[email protected]> wrote:
>
> > > Hi Jeffrey
>
> > > SphinxHelper isn't used much - beyond setting up the database, but  
> > > that's just to avoid complaints from the models. It definitely doesn't  
> > > generate an index file nor run Sphinx. If you need to test against a  
> > > live Sphinx setup, I'd prefer you used the cucumber features. Add your  
> > > model to features/support/models/, and a migration - using the old 1.x  
> > > syntax if you would like me to merge - to features/support/db/
> > > migrations/.
>
> > > To run a single cucumber feature, you need to regenerate the  
> > > cucumber.yml file using rake cucumber_defaults, and then use the  
> > > default profile:
> > >    cucumber -p default features/whatever.feature
>
> > > To run all the features, the rake tasks features:mysql and  
> > > features:postgresql are what you need to call. If your system supports  
> > > both, you can run both at once with 'rake features'.
>
> > > Hope this is helpful - let me know if you get stuck.
>
> > > Cheers
>
> > > --
> > > Pat
>
> > > On 28/02/2009, at 11:28 AM, Jeffrey Chupp wrote:
>
> > > > I'm trying to make some modifications to Thinking Sphinx, but sadly
> > > > can't figure out how to force an index to build in the specs.  I'm in
> > > > active_record_spec and my model is fine and there are entries in the
> > > > db.  What code should I add to force the index to build?
>
> > > > I read the codebase, but it wasn't obvious to me.  There's the
> > > > SphinxHelper which has an index method, but it isn't used anywhere
> > > > that I can find, and I can't grok how I would use it.
>
> > > > All that I want to do is force an index to build on a single model.
> > > > Any advice you can offer would be very helpful.  Apologies if this is
> > > > covered somewhere that I missed.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to