Created
May 17, 2011 15:38
-
-
Save zeroeth/976712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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