thinking-sphinx-099 1.2.12 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/README.textile +4 -17
  2. data/VERSION.yml +2 -1
  3. data/features/alternate_primary_key.feature +27 -0
  4. data/features/attribute_transformation.feature +22 -0
  5. data/features/attribute_updates.feature +33 -0
  6. data/features/datetime_deltas.feature +66 -0
  7. data/features/delayed_delta_indexing.feature +37 -0
  8. data/features/deleting_instances.feature +64 -0
  9. data/features/direct_attributes.feature +11 -0
  10. data/features/excerpts.feature +13 -0
  11. data/features/extensible_delta_indexing.feature +9 -0
  12. data/features/facets.feature +76 -0
  13. data/features/facets_across_model.feature +29 -0
  14. data/features/handling_edits.feature +76 -0
  15. data/features/retry_stale_indexes.feature +24 -0
  16. data/features/searching_across_models.feature +20 -0
  17. data/features/searching_by_model.feature +175 -0
  18. data/features/searching_with_find_arguments.feature +56 -0
  19. data/features/sphinx_detection.feature +25 -0
  20. data/features/sphinx_scopes.feature +35 -0
  21. data/features/step_definitions/alpha_steps.rb +3 -0
  22. data/features/step_definitions/beta_steps.rb +7 -0
  23. data/features/step_definitions/common_steps.rb +174 -0
  24. data/features/step_definitions/datetime_delta_steps.rb +15 -0
  25. data/features/step_definitions/delayed_delta_indexing_steps.rb +7 -0
  26. data/features/step_definitions/extensible_delta_indexing_steps.rb +7 -0
  27. data/features/step_definitions/facet_steps.rb +92 -0
  28. data/features/step_definitions/find_arguments_steps.rb +36 -0
  29. data/features/step_definitions/gamma_steps.rb +15 -0
  30. data/features/step_definitions/scope_steps.rb +11 -0
  31. data/features/step_definitions/search_steps.rb +89 -0
  32. data/features/step_definitions/sphinx_steps.rb +31 -0
  33. data/features/sti_searching.feature +14 -0
  34. data/features/support/database.example.yml +3 -0
  35. data/features/support/database.yml +5 -0
  36. data/features/support/db/active_record.rb +40 -0
  37. data/features/support/db/database.yml +5 -0
  38. data/features/support/db/fixtures/alphas.rb +10 -0
  39. data/features/support/db/fixtures/authors.rb +1 -0
  40. data/features/support/db/fixtures/betas.rb +10 -0
  41. data/features/support/db/fixtures/boxes.rb +9 -0
  42. data/features/support/db/fixtures/categories.rb +1 -0
  43. data/features/support/db/fixtures/cats.rb +3 -0
  44. data/features/support/db/fixtures/comments.rb +24 -0
  45. data/features/support/db/fixtures/delayed_betas.rb +10 -0
  46. data/features/support/db/fixtures/developers.rb +29 -0
  47. data/features/support/db/fixtures/dogs.rb +3 -0
  48. data/features/support/db/fixtures/extensible_betas.rb +10 -0
  49. data/features/support/db/fixtures/gammas.rb +10 -0
  50. data/features/support/db/fixtures/people.rb +1001 -0
  51. data/features/support/db/fixtures/posts.rb +6 -0
  52. data/features/support/db/fixtures/robots.rb +14 -0
  53. data/features/support/db/fixtures/tags.rb +27 -0
  54. data/features/support/db/fixtures/thetas.rb +10 -0
  55. data/features/support/db/migrations/create_alphas.rb +7 -0
  56. data/features/support/db/migrations/create_animals.rb +5 -0
  57. data/features/support/db/migrations/create_authors.rb +3 -0
  58. data/features/support/db/migrations/create_authors_posts.rb +6 -0
  59. data/features/support/db/migrations/create_betas.rb +5 -0
  60. data/features/support/db/migrations/create_boxes.rb +5 -0
  61. data/features/support/db/migrations/create_categories.rb +3 -0
  62. data/features/support/db/migrations/create_comments.rb +10 -0
  63. data/features/support/db/migrations/create_delayed_betas.rb +17 -0
  64. data/features/support/db/migrations/create_developers.rb +9 -0
  65. data/features/support/db/migrations/create_extensible_betas.rb +5 -0
  66. data/features/support/db/migrations/create_gammas.rb +3 -0
  67. data/features/support/db/migrations/create_people.rb +13 -0
  68. data/features/support/db/migrations/create_posts.rb +5 -0
  69. data/features/support/db/migrations/create_robots.rb +4 -0
  70. data/features/support/db/migrations/create_taggings.rb +5 -0
  71. data/features/support/db/migrations/create_tags.rb +4 -0
  72. data/features/support/db/migrations/create_thetas.rb +5 -0
  73. data/features/support/db/mysql.rb +3 -0
  74. data/features/support/db/postgresql.rb +3 -0
  75. data/features/support/env.rb +18 -0
  76. data/features/support/lib/generic_delta_handler.rb +8 -0
  77. data/features/support/models/alpha.rb +10 -0
  78. data/features/support/models/animal.rb +5 -0
  79. data/features/support/models/author.rb +3 -0
  80. data/features/support/models/beta.rb +8 -0
  81. data/features/support/models/box.rb +8 -0
  82. data/features/support/models/cat.rb +3 -0
  83. data/features/support/models/category.rb +4 -0
  84. data/features/support/models/comment.rb +10 -0
  85. data/features/support/models/delayed_beta.rb +7 -0
  86. data/features/support/models/developer.rb +16 -0
  87. data/features/support/models/dog.rb +3 -0
  88. data/features/support/models/extensible_beta.rb +9 -0
  89. data/features/support/models/gamma.rb +5 -0
  90. data/features/support/models/person.rb +23 -0
  91. data/features/support/models/post.rb +20 -0
  92. data/features/support/models/robot.rb +12 -0
  93. data/features/support/models/tag.rb +3 -0
  94. data/features/support/models/tagging.rb +4 -0
  95. data/features/support/models/theta.rb +7 -0
  96. data/features/support/post_database.rb +43 -0
  97. data/lib/cucumber/thinking_sphinx/internal_world.rb +125 -0
  98. data/lib/cucumber/thinking_sphinx/sql_logger.rb +20 -0
  99. data/lib/thinking_sphinx.rb +4 -2
  100. data/lib/thinking_sphinx/active_record.rb +1 -2
  101. data/lib/thinking_sphinx/adapters/mysql_adapter.rb +1 -1
  102. data/lib/thinking_sphinx/adapters/postgresql_adapter.rb +18 -11
  103. data/lib/thinking_sphinx/attribute.rb +3 -4
  104. data/lib/thinking_sphinx/excerpter.rb +1 -1
  105. data/lib/thinking_sphinx/search.rb +1 -0
  106. data/lib/thinking_sphinx/source.rb +1 -1
  107. data/spec/lib/thinking_sphinx/active_record_spec.rb +0 -11
  108. data/spec/lib/thinking_sphinx/attribute_spec.rb +14 -7
  109. data/spec/lib/thinking_sphinx/deltas/job_spec.rb +32 -0
  110. data/spec/lib/thinking_sphinx/excerpter_spec.rb +8 -0
  111. data/spec/lib/thinking_sphinx/search_spec.rb +9 -0
  112. data/tasks/distribution.rb +4 -1
  113. data/tasks/testing.rb +8 -19
  114. metadata +99 -2
@@ -0,0 +1,43 @@
1
+ $:.unshift File.dirname(__FILE__) + '/../../lib'
2
+
3
+ require 'lib/thinking_sphinx'
4
+
5
+ %w( tmp/config tmp/log tmp/db/sphinx/development ).each do |path|
6
+ FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
7
+ end
8
+
9
+ Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT)
10
+
11
+ at_exit do
12
+ ThinkingSphinx::Configuration.instance.controller.stop
13
+ sleep(1) # Ensure Sphinx has shut down completely
14
+ ActiveRecord::Base.logger.close
15
+ FileUtils.rm_r "#{Dir.pwd}/tmp"
16
+ end
17
+
18
+ # Add log file
19
+ ActiveRecord::Base.logger = Logger.new open("tmp/active_record.log", "a")
20
+
21
+ # Set up database tables
22
+ Dir["features/support/db/migrations/*.rb"].each do |file|
23
+ require file.gsub(/\.rb$/, '')
24
+ end
25
+
26
+ # Load Models
27
+ Dir["features/support/models/*.rb"].sort.each do |file|
28
+ require file.gsub(/\.rb$/, '')
29
+ end
30
+
31
+ ThinkingSphinx.deltas_enabled = false
32
+
33
+ # Load Fixtures
34
+ Dir["features/support/db/fixtures/*.rb"].each do |file|
35
+ require file.gsub(/\.rb$/, '')
36
+ end
37
+
38
+ ThinkingSphinx.deltas_enabled = true
39
+ ThinkingSphinx.suppress_delta_output = true
40
+
41
+ ThinkingSphinx::Configuration.instance.build
42
+ ThinkingSphinx::Configuration.instance.controller.index
43
+ ThinkingSphinx::Configuration.instance.controller.start
@@ -0,0 +1,125 @@
1
+ require 'cucumber/thinking_sphinx/sql_logger'
2
+
3
+ module Cucumber
4
+ module ThinkingSphinx
5
+ class InternalWorld
6
+ attr_accessor :temporary_directory, :migrations_directory,
7
+ :models_directory, :fixtures_directory, :database_file
8
+ attr_accessor :adapter, :database, :username,
9
+ :password, :host
10
+
11
+ def initialize
12
+ @temporary_directory = "#{Dir.pwd}/tmp"
13
+ @migrations_directory = "features/support/db/migrations"
14
+ @models_directory = "features/support/models"
15
+ @fixtures_directory = "features/support/db/fixtures"
16
+ @database_file = "features/support/database.yml"
17
+
18
+ @adapter = ENV['DATABASE'] || 'mysql'
19
+ @database = 'thinking_sphinx'
20
+ @username = 'thinking_sphinx'
21
+ # @password = 'thinking_sphinx'
22
+ @host = 'localhost'
23
+ end
24
+
25
+ def setup
26
+ make_temporary_directory
27
+
28
+ configure_cleanup
29
+ configure_thinking_sphinx
30
+ configure_active_record
31
+
32
+ prepare_data
33
+ setup_sphinx
34
+
35
+ self
36
+ end
37
+
38
+ def configure_database
39
+ ActiveRecord::Base.establish_connection database_settings
40
+ self
41
+ end
42
+
43
+ private
44
+
45
+ def config
46
+ @config ||= ::ThinkingSphinx::Configuration.instance
47
+ end
48
+
49
+ def make_temporary_directory
50
+ FileUtils.mkdir_p temporary_directory
51
+ Dir["#{temporary_directory}/*"].each do |file|
52
+ FileUtils.rm_rf file
53
+ end
54
+ end
55
+
56
+ def configure_thinking_sphinx
57
+ config.config_file = "#{temporary_directory}/sphinx.conf"
58
+ config.searchd_log_file = "#{temporary_directory}/searchd.log"
59
+ config.query_log_file = "#{temporary_directory}/searchd.query.log"
60
+ config.pid_file = "#{temporary_directory}/searchd.pid"
61
+ config.searchd_file_path = "#{temporary_directory}/indexes/"
62
+
63
+ ::ThinkingSphinx.suppress_delta_output = true
64
+ end
65
+
66
+ def configure_cleanup
67
+ Kernel.at_exit do
68
+ ::ThinkingSphinx::Configuration.instance.controller.stop
69
+ sleep(0.5) # Ensure Sphinx has shut down completely
70
+ ActiveRecord::Base.logger.close
71
+ end
72
+ end
73
+
74
+ def yaml_database_settings
75
+ return {} unless File.exist?(@database_file)
76
+
77
+ YAML.load open(@database_file)
78
+ end
79
+
80
+ def database_settings
81
+ {
82
+ :adapter => @adapter,
83
+ :database => @database,
84
+ :username => @username,
85
+ :password => @password,
86
+ :host => @host
87
+ }.merge yaml_database_settings
88
+ end
89
+
90
+ def configure_active_record
91
+ ActiveRecord::Base.logger = Logger.new(
92
+ open("#{temporary_directory}/active_record.log", "a")
93
+ )
94
+
95
+ ActiveRecord::Base.connection.class.send(
96
+ :include, Cucumber::ThinkingSphinx::SqlLogger
97
+ )
98
+ end
99
+
100
+ def prepare_data
101
+ ::ThinkingSphinx.deltas_enabled = false
102
+
103
+ load_files migrations_directory
104
+ load_files models_directory
105
+ load_files fixtures_directory
106
+
107
+ ::ThinkingSphinx.deltas_enabled = true
108
+ end
109
+
110
+ def load_files(path)
111
+ Dir["#{path}/*.rb"].each do |file|
112
+ require file.gsub(/\.rb$/, '')
113
+ end
114
+ end
115
+
116
+ def setup_sphinx
117
+ FileUtils.mkdir_p config.searchd_file_path
118
+
119
+ config.build
120
+ config.controller.index
121
+ config.controller.start
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,20 @@
1
+ module Cucumber
2
+ module ThinkingSphinx
3
+ module SqlLogger
4
+ def self.included(base)
5
+ base.send :alias_method_chain, :execute, :query_record
6
+ end
7
+
8
+ IGNORED_SQL = [
9
+ /^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/,
10
+ /^SELECT @@ROWCOUNT/, /^SHOW FIELDS/
11
+ ]
12
+
13
+ def execute_with_query_record(sql, name = nil, &block)
14
+ $queries_executed ||= []
15
+ $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
16
+ execute_without_query_record(sql, name, &block)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -6,6 +6,7 @@ require 'active_record'
6
6
  require 'riddle'
7
7
  require 'after_commit'
8
8
  require 'yaml'
9
+ require 'cgi'
9
10
 
10
11
  require 'thinking_sphinx/core/array'
11
12
  require 'thinking_sphinx/core/string'
@@ -130,12 +131,13 @@ module ThinkingSphinx
130
131
  def self.suppress_delta_output=(value)
131
132
  @@suppress_delta_output = value
132
133
  end
133
-
134
+
135
+ @@use_group_by_shortcut = nil
134
136
  # Checks to see if MySQL will allow simplistic GROUP BY statements. If not,
135
137
  # or if not using MySQL, this will return false.
136
138
  #
137
139
  def self.use_group_by_shortcut?
138
- !!(
140
+ @@use_group_by_shortcut ||= !!(
139
141
  mysql? && ::ActiveRecord::Base.connection.select_all(
140
142
  "SELECT @@global.sql_mode, @@session.sql_mode;"
141
143
  ).all? { |key,value| value.nil? || value[/ONLY_FULL_GROUP_BY/].nil? }
@@ -276,8 +276,7 @@ module ThinkingSphinx
276
276
  "#{self.class.sphinx_indexes.first.name}_delta",
277
277
  ['sphinx_deleted'],
278
278
  {self.sphinx_document_id => [1]}
279
- ) if ThinkingSphinx.deltas_enabled? &&
280
- self.class.sphinx_indexes.any? { |index| index.delta? } &&
279
+ ) if self.class.sphinx_indexes.any? { |index| index.delta? } &&
281
280
  self.toggled_delta?
282
281
  rescue ::ThinkingSphinx::ConnectionError
283
282
  # nothing
@@ -13,7 +13,7 @@ module ThinkingSphinx
13
13
  end
14
14
 
15
15
  def group_concatenate(clause, separator = ' ')
16
- "GROUP_CONCAT(DISTINCT #{clause} SEPARATOR '#{separator}')"
16
+ "GROUP_CONCAT(DISTINCT IFNULL(#{clause}, '0') SEPARATOR '#{separator}')"
17
17
  end
18
18
 
19
19
  def cast_to_string(clause)
@@ -10,18 +10,17 @@ module ThinkingSphinx
10
10
  end
11
11
 
12
12
  def concatenate(clause, separator = ' ')
13
- clause.split(', ').collect { |field|
14
- case field
15
- when /COALESCE/, "'')"
16
- field
17
- else
18
- "COALESCE(CAST(#{field} as varchar), '')"
19
- end
20
- }.join(" || '#{separator}' || ")
13
+ if clause[/^COALESCE/]
14
+ clause.split('), ').join(") || '#{separator}' || ")
15
+ else
16
+ clause.split(', ').collect { |field|
17
+ "CAST(COALESCE(#{field}, '') as varchar)"
18
+ }.join(" || '#{separator}' || ")
19
+ end
21
20
  end
22
21
 
23
22
  def group_concatenate(clause, separator = ' ')
24
- "array_to_string(array_accum(#{clause}), '#{separator}')"
23
+ "array_to_string(array_accum(COALESCE(#{clause}, '0')), '#{separator}')"
25
24
  end
26
25
 
27
26
  def cast_to_string(clause)
@@ -37,8 +36,16 @@ module ThinkingSphinx
37
36
  end
38
37
 
39
38
  def convert_nulls(clause, default = '')
40
- default = "'#{default}'" if default.is_a?(String)
41
- default = 'NULL' if default.nil?
39
+ default = case default
40
+ when String
41
+ "'#{default}'"
42
+ when NilClass
43
+ 'NULL'
44
+ when Fixnum
45
+ "#{default}::bigint"
46
+ else
47
+ default
48
+ end
42
49
 
43
50
  "COALESCE(#{clause}, #{default})"
44
51
  end
@@ -101,13 +101,14 @@ module ThinkingSphinx
101
101
  when :datetime
102
102
  adapter.cast_to_datetime(part)
103
103
  when :multi
104
- adapter.convert_nulls(part, 0)
104
+ part = adapter.cast_to_datetime(part) if is_many_datetimes?
105
+ part = adapter.convert_nulls(part, '0') if is_many_ints?
106
+ part
105
107
  else
106
108
  part
107
109
  end
108
110
  }.join(', ')
109
111
 
110
- # clause = adapter.cast_to_datetime(clause) if type == :datetime
111
112
  clause = adapter.crc(clause) if @crc
112
113
  clause = adapter.concatenate(clause, separator) if concat_ws?
113
114
  clause = adapter.group_concatenate(clause, separator) if is_many?
@@ -153,8 +154,6 @@ module ThinkingSphinx
153
154
  def type
154
155
  @type ||= begin
155
156
  base_type = case
156
- when is_many_datetimes?
157
- :datetime
158
157
  when is_many?, is_many_ints?
159
158
  :multi
160
159
  when @associations.values.flatten.length > 1
@@ -14,7 +14,7 @@ module ThinkingSphinx
14
14
  end
15
15
 
16
16
  def method_missing(method, *args, &block)
17
- string = @instance.send(method, *args, &block).to_s
17
+ string = CGI::escapeHTML @instance.send(method, *args, &block).to_s
18
18
 
19
19
  @search.excerpt_for(string, @instance.class)
20
20
  end
@@ -192,6 +192,7 @@ module ThinkingSphinx
192
192
  match[:attributes]["@count"]
193
193
  end
194
194
  end
195
+ alias_method :each_with_group_and_count, :each_with_groupby_and_count
195
196
 
196
197
  def each_with_weighting(&block)
197
198
  populate
@@ -33,7 +33,7 @@ module ThinkingSphinx
33
33
  end
34
34
 
35
35
  def name
36
- @model.name.underscore.tr(':/\\', '_')
36
+ @model.sphinx_name
37
37
  end
38
38
 
39
39
  def to_riddle_for_core(offset, index)
@@ -268,17 +268,6 @@ describe ThinkingSphinx::ActiveRecord do
268
268
  @person.toggle_deleted
269
269
  end
270
270
 
271
- it "should not update the delta index if delta indexing is disabled" do
272
- ThinkingSphinx.deltas_enabled = false
273
- Person.sphinx_indexes.each { |index| index.stub!(:delta? => true) }
274
- @person.delta = true
275
- @client.should_not_receive(:update).with(
276
- "person_delta", ["sphinx_deleted"], {@person.sphinx_document_id => [1]}
277
- )
278
-
279
- @person.toggle_deleted
280
- end
281
-
282
271
  it "should not update either index if updates are disabled" do
283
272
  ThinkingSphinx.updates_enabled = false
284
273
  ThinkingSphinx.deltas_enabled = true
@@ -22,7 +22,7 @@ describe ThinkingSphinx::Attribute do
22
22
  end
23
23
  end
24
24
 
25
- describe "unique_name method" do
25
+ describe '#unique_name' do
26
26
  before :each do
27
27
  @attribute = ThinkingSphinx::Attribute.new @source, [
28
28
  stub('column', :__stack => [], :__name => "col_name")
@@ -47,7 +47,7 @@ describe ThinkingSphinx::Attribute do
47
47
  end
48
48
  end
49
49
 
50
- describe "column_with_prefix method" do
50
+ describe '#column_with_prefix' do
51
51
  before :each do
52
52
  @attribute = ThinkingSphinx::Attribute.new @source, [
53
53
  ThinkingSphinx::Index::FauxColumn.new(:col_name)
@@ -101,7 +101,7 @@ describe ThinkingSphinx::Attribute do
101
101
  end
102
102
  end
103
103
 
104
- describe "is_many? method" do
104
+ describe '#is_many?' do
105
105
  before :each do
106
106
  @assoc_a = stub('assoc', :is_many? => true)
107
107
  @assoc_b = stub('assoc', :is_many? => true)
@@ -135,7 +135,7 @@ describe ThinkingSphinx::Attribute do
135
135
  end
136
136
  end
137
137
 
138
- describe "is_string? method" do
138
+ describe '#is_string?' do
139
139
  before :each do
140
140
  @col_a = ThinkingSphinx::Index::FauxColumn.new("a")
141
141
  @col_b = ThinkingSphinx::Index::FauxColumn.new("b")
@@ -163,7 +163,7 @@ describe ThinkingSphinx::Attribute do
163
163
  end
164
164
  end
165
165
 
166
- describe "type method" do
166
+ describe '#type' do
167
167
  before :each do
168
168
  @column = ThinkingSphinx::Index::FauxColumn.new(:col_name)
169
169
  @attribute = ThinkingSphinx::Attribute.new(@source, [@column])
@@ -193,9 +193,16 @@ describe ThinkingSphinx::Attribute do
193
193
  @column.send(:instance_variable_set, :@name, "id")
194
194
  @attribute.send(:type).should == :integer
195
195
  end
196
+
197
+ it "should return :multi if the columns return multiple datetimes" do
198
+ @attribute.stub!(:is_many? => true)
199
+ @attribute.stub!(:all_datetimes? => true)
200
+
201
+ @attribute.type.should == :multi
202
+ end
196
203
  end
197
204
 
198
- describe "all_ints? method" do
205
+ describe '#all_ints?' do
199
206
  it "should return true if all columns are integers" do
200
207
  attribute = ThinkingSphinx::Attribute.new(@source,
201
208
  [ ThinkingSphinx::Index::FauxColumn.new(:id),
@@ -230,7 +237,7 @@ describe ThinkingSphinx::Attribute do
230
237
  end
231
238
  end
232
239
 
233
- describe "all_datetimes? method" do
240
+ describe '#all_datetimes?' do
234
241
  it "should return true if all columns are datetimes" do
235
242
  attribute = ThinkingSphinx::Attribute.new(@source,
236
243
  [ ThinkingSphinx::Index::FauxColumn.new(:created_at),
@@ -0,0 +1,32 @@
1
+ require 'spec/spec_helper'
2
+
3
+ describe ThinkingSphinx::Deltas::Job do
4
+ describe '.cancel_thinking_sphinx_jobs' do
5
+ before :each do
6
+ ThinkingSphinx::Deltas::Job.stub!(:delete_all => true)
7
+ end
8
+
9
+ it "should not delete any rows if the delayed_jobs table does not exist" do
10
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => [])
11
+ ThinkingSphinx::Deltas::Job.should_not_receive(:delete_all)
12
+
13
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
14
+ end
15
+
16
+ it "should delete rows if the delayed_jobs table does exist" do
17
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
18
+ ThinkingSphinx::Deltas::Job.should_receive(:delete_all)
19
+
20
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
21
+ end
22
+
23
+ it "should delete only Thinking Sphinx jobs" do
24
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
25
+ ThinkingSphinx::Deltas::Job.should_receive(:delete_all) do |sql|
26
+ sql.should match(/handler LIKE '--- !ruby\/object:ThinkingSphinx::Deltas::\%'/)
27
+ end
28
+
29
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
30
+ end
31
+ end
32
+ end