Skip to content

Commit

Permalink
@BugFix Clean Message server of "elasticsearch" when run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroig authored and angelf committed Jan 7, 2011
1 parent c8c231c commit b9b9d1b
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions test/nrt_enqueue_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# tests the Near Real Time support in the :updates => true mode

require 'test_helper'


require File.dirname(__FILE__) + '/test_helper.rb'

class NrtEnqueue < Test::Unit::TestCase
Expand All @@ -26,13 +24,10 @@ def setup

def test_document_creation
# the Resque tasks have not run yet, so there should be nothing in the index
User.refresh_index
assert_equal 0, User.search_count

# now run the Resque tasks and check that the index is good
# but now run the Resque tasks and check that the index is good
Resque.run!
User.refresh_index

assert_equal 5, User.search("*").total_entries
results = User.search("wise")
assert_equal results.total_entries, 1
Expand All @@ -43,8 +38,9 @@ def test_document_updates
# now run the Resque tasks and check that the index is good
Resque.run!
User.refresh_index

assert_equal 5, User.search("*").total_entries

# make a change in a document
@tim.name = 'Tim the Reborn'
@tim.save!
Expand All @@ -67,20 +63,18 @@ def test_document_deletes
Resque.run!
User.refresh_index

#puts "TOTAL: " + User.search("*").inspect
#puts "TOTAL: " + User.search("*").total_entries.to_s
assert_equal User.search("*").total_entries, 5

# Destroy the element
@tim.destroy
User.refresh_index

#puts "TOTAL POST DESTROY: " + User.search("*").total_entries.to_s
# but still there until run Resque
assert_equal User.search("*").total_entries, 5

# but when we run the Resque tasks, all is well
Resque.run!
User.refresh_index

assert_equal User.search("*").total_entries, 4
end

Expand Down

0 comments on commit b9b9d1b

Please sign in to comment.