Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created May 17, 2011 15:38
Show Gist options
  • Select an option

  • Save zeroeth/976712 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/976712 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../test_helper'
class DealSearchTest < ActiveSupport::TestCase
self.use_transactional_fixtures = false
context "Search" do
should "search keywords" do
Deal.delete_all
Deal.transaction do
@deal1 = Factory :internal_deal, :keywords => 'kayak delorean'
@deal2 = Factory :internal_deal, :keywords => 'kayak'
@deal3 = Factory :internal_deal, :keywords => ''
end
ThinkingSphinx::Test.run do # all indexes
ThinkingSphinx::Test.index
sleep(1)
assert_equal [@deal1, @deal2].map(&:id), Deal.search('kayak').map(&:id)
assert_equal [@deal1].map(&:id), Deal.search('delorean').map(&:id)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment