Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:12:10+00:00 2026-05-22T17:12:10+00:00

this is my test (with shoulda helpers): context searching from header do setup do

  • 0

this is my test (with shoulda helpers):

  context "searching from header" do
    setup do
      Factory(:city, :name => 'Testing It')
      ThinkingSphinx::Test.index 'city_core', 'city_delta'
      ThinkingSphinx::Test.start

      get :index,
          :query => 'Testing It'
    end

    should respond_with(:success)
    should assign_to(:results)
    should "have one city on the result" do
      assert_equal( assigns(:results).count, 1 )
      assert_kind_of( assigns(:results).first, City )
    end

    ThinkingSphinx::Test.stop
  end

Everything works fine except the test always say the count of the results is 0, not 1.

I have debugged this code and when the request reaches the controller, the Sphinx indexes are completely empty, even with the explicit call of index for it.

Am I doing something wrong here?

Any help appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:12:10+00:00Added an answer on May 22, 2026 at 5:12 pm

    I found out the problem… even tho the insertion in the database is right before the ThinkingSphinx.index, with transactional fixtures, after the setup block the records get deleted.

    The solution was adding to the test the following line:

    self.use_transactional_fixtures = false
    

    Hope this helps anyone with the same problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some difficulties in testing devise with shoulda: 2) Error: test: handle :index
How can i remove $_SERVER['DOCUMENT_ROOT'] from a string like this /home/bla/test/pic/photo.jpg the result should
I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c
This is from Michael Hartl's book, section 8.4. RSpec is testing a successful signup
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
i have tried this: <?php $fileip = fopen(test.txt,r); ?> this should have opened the
On this test page: http:// www.onebagoneearth.com/ Products-test , where it says oboe love series,
Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
Why does this test program result in a java.lang.IllegalMonitorStateException ? public class test {
I'm puzzled with this test script: #!perl use strict; use warnings; use encoding 'utf8';

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.