sherpa99-thinking-sphinx 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. data/LICENCE +20 -0
  2. data/README +107 -0
  3. data/README.textile +107 -0
  4. data/Rakefile +4 -0
  5. data/contribute.rb +328 -0
  6. data/cucumber.yml +1 -0
  7. data/features/a.rb +17 -0
  8. data/features/attribute_transformation.feature +22 -0
  9. data/features/datetime_deltas.feature +55 -0
  10. data/features/delayed_delta_indexing.feature +37 -0
  11. data/features/deleting_instances.feature +52 -0
  12. data/features/facets.feature +26 -0
  13. data/features/handling_edits.feature +67 -0
  14. data/features/retry_stale_indexes.feature +24 -0
  15. data/features/searching_across_models.feature +20 -0
  16. data/features/searching_by_model.feature +118 -0
  17. data/features/searching_with_find_arguments.feature +56 -0
  18. data/features/sphinx_detection.feature +16 -0
  19. data/features/step_definitions/alpha_steps.rb +3 -0
  20. data/features/step_definitions/beta_steps.rb +11 -0
  21. data/features/step_definitions/cat_steps.rb +3 -0
  22. data/features/step_definitions/common_steps.rb +154 -0
  23. data/features/step_definitions/datetime_delta_steps.rb +11 -0
  24. data/features/step_definitions/delayed_delta_indexing_steps.rb +7 -0
  25. data/features/step_definitions/facet_steps.rb +30 -0
  26. data/features/step_definitions/find_arguments_steps.rb +36 -0
  27. data/features/step_definitions/gamma_steps.rb +15 -0
  28. data/features/step_definitions/search_steps.rb +66 -0
  29. data/features/step_definitions/sphinx_steps.rb +23 -0
  30. data/features/support/db/active_record.rb +40 -0
  31. data/features/support/db/database.example.yml +4 -0
  32. data/features/support/db/migrations/create_alphas.rb +18 -0
  33. data/features/support/db/migrations/create_animals.rb +9 -0
  34. data/features/support/db/migrations/create_betas.rb +15 -0
  35. data/features/support/db/migrations/create_boxes.rb +13 -0
  36. data/features/support/db/migrations/create_comments.rb +13 -0
  37. data/features/support/db/migrations/create_delayed_betas.rb +28 -0
  38. data/features/support/db/migrations/create_developers.rb +39 -0
  39. data/features/support/db/migrations/create_gammas.rb +14 -0
  40. data/features/support/db/migrations/create_people.rb +1014 -0
  41. data/features/support/db/migrations/create_posts.rb +6 -0
  42. data/features/support/db/migrations/create_thetas.rb +16 -0
  43. data/features/support/db/mysql.rb +4 -0
  44. data/features/support/db/postgresql.rb +4 -0
  45. data/features/support/env.rb +6 -0
  46. data/features/support/models/alpha.rb +9 -0
  47. data/features/support/models/animal.rb +5 -0
  48. data/features/support/models/beta.rb +7 -0
  49. data/features/support/models/box.rb +8 -0
  50. data/features/support/models/cat.rb +3 -0
  51. data/features/support/models/comment.rb +3 -0
  52. data/features/support/models/delayed_beta.rb +7 -0
  53. data/features/support/models/developer.rb +8 -0
  54. data/features/support/models/gamma.rb +5 -0
  55. data/features/support/models/person.rb +8 -0
  56. data/features/support/models/post.rb +8 -0
  57. data/features/support/models/theta.rb +7 -0
  58. data/features/support/post_database.rb +37 -0
  59. data/features/support/z.rb +19 -0
  60. data/ginger_scenarios.rb +24 -0
  61. data/init.rb +12 -0
  62. data/lib/thinking_sphinx.rb +144 -0
  63. data/lib/thinking_sphinx/active_record.rb +245 -0
  64. data/lib/thinking_sphinx/active_record/delta.rb +74 -0
  65. data/lib/thinking_sphinx/active_record/has_many_association.rb +29 -0
  66. data/lib/thinking_sphinx/active_record/search.rb +57 -0
  67. data/lib/thinking_sphinx/adapters/abstract_adapter.rb +34 -0
  68. data/lib/thinking_sphinx/adapters/mysql_adapter.rb +53 -0
  69. data/lib/thinking_sphinx/adapters/postgresql_adapter.rb +129 -0
  70. data/lib/thinking_sphinx/association.rb +144 -0
  71. data/lib/thinking_sphinx/attribute.rb +258 -0
  72. data/lib/thinking_sphinx/collection.rb +142 -0
  73. data/lib/thinking_sphinx/configuration.rb +236 -0
  74. data/lib/thinking_sphinx/core/string.rb +22 -0
  75. data/lib/thinking_sphinx/deltas.rb +22 -0
  76. data/lib/thinking_sphinx/deltas/datetime_delta.rb +50 -0
  77. data/lib/thinking_sphinx/deltas/default_delta.rb +65 -0
  78. data/lib/thinking_sphinx/deltas/delayed_delta.rb +25 -0
  79. data/lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb +24 -0
  80. data/lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb +27 -0
  81. data/lib/thinking_sphinx/deltas/delayed_delta/job.rb +26 -0
  82. data/lib/thinking_sphinx/facet.rb +58 -0
  83. data/lib/thinking_sphinx/facet_collection.rb +44 -0
  84. data/lib/thinking_sphinx/field.rb +172 -0
  85. data/lib/thinking_sphinx/index.rb +414 -0
  86. data/lib/thinking_sphinx/index/builder.rb +233 -0
  87. data/lib/thinking_sphinx/index/faux_column.rb +110 -0
  88. data/lib/thinking_sphinx/rails_additions.rb +133 -0
  89. data/lib/thinking_sphinx/search.rb +638 -0
  90. data/lib/thinking_sphinx/tasks.rb +128 -0
  91. data/rails/init.rb +6 -0
  92. data/spec/fixtures/data.sql +32 -0
  93. data/spec/fixtures/database.yml.default +3 -0
  94. data/spec/fixtures/models.rb +81 -0
  95. data/spec/fixtures/structure.sql +84 -0
  96. data/spec/spec_helper.rb +54 -0
  97. data/spec/sphinx_helper.rb +109 -0
  98. data/spec/unit/thinking_sphinx/active_record/delta_spec.rb +136 -0
  99. data/spec/unit/thinking_sphinx/active_record/has_many_association_spec.rb +53 -0
  100. data/spec/unit/thinking_sphinx/active_record/search_spec.rb +107 -0
  101. data/spec/unit/thinking_sphinx/active_record_spec.rb +256 -0
  102. data/spec/unit/thinking_sphinx/association_spec.rb +247 -0
  103. data/spec/unit/thinking_sphinx/attribute_spec.rb +212 -0
  104. data/spec/unit/thinking_sphinx/collection_spec.rb +14 -0
  105. data/spec/unit/thinking_sphinx/configuration_spec.rb +136 -0
  106. data/spec/unit/thinking_sphinx/core/string_spec.rb +9 -0
  107. data/spec/unit/thinking_sphinx/field_spec.rb +145 -0
  108. data/spec/unit/thinking_sphinx/index/builder_spec.rb +5 -0
  109. data/spec/unit/thinking_sphinx/index/faux_column_spec.rb +30 -0
  110. data/spec/unit/thinking_sphinx/index_spec.rb +54 -0
  111. data/spec/unit/thinking_sphinx/search_spec.rb +59 -0
  112. data/spec/unit/thinking_sphinx_spec.rb +129 -0
  113. data/tasks/distribution.rb +48 -0
  114. data/tasks/rails.rake +1 -0
  115. data/tasks/testing.rb +86 -0
  116. data/thinking-sphinx.gemspec +232 -0
  117. data/vendor/after_commit/LICENSE +20 -0
  118. data/vendor/after_commit/README +16 -0
  119. data/vendor/after_commit/Rakefile +22 -0
  120. data/vendor/after_commit/init.rb +5 -0
  121. data/vendor/after_commit/lib/after_commit.rb +42 -0
  122. data/vendor/after_commit/lib/after_commit/active_record.rb +91 -0
  123. data/vendor/after_commit/lib/after_commit/connection_adapters.rb +103 -0
  124. data/vendor/after_commit/test/after_commit_test.rb +53 -0
  125. data/vendor/delayed_job/lib/delayed/job.rb +251 -0
  126. data/vendor/delayed_job/lib/delayed/message_sending.rb +7 -0
  127. data/vendor/delayed_job/lib/delayed/performable_method.rb +55 -0
  128. data/vendor/delayed_job/lib/delayed/worker.rb +54 -0
  129. data/vendor/riddle/lib/riddle.rb +30 -0
  130. data/vendor/riddle/lib/riddle/client.rb +619 -0
  131. data/vendor/riddle/lib/riddle/client/filter.rb +53 -0
  132. data/vendor/riddle/lib/riddle/client/message.rb +65 -0
  133. data/vendor/riddle/lib/riddle/client/response.rb +84 -0
  134. data/vendor/riddle/lib/riddle/configuration.rb +33 -0
  135. data/vendor/riddle/lib/riddle/configuration/distributed_index.rb +48 -0
  136. data/vendor/riddle/lib/riddle/configuration/index.rb +142 -0
  137. data/vendor/riddle/lib/riddle/configuration/indexer.rb +19 -0
  138. data/vendor/riddle/lib/riddle/configuration/remote_index.rb +17 -0
  139. data/vendor/riddle/lib/riddle/configuration/searchd.rb +25 -0
  140. data/vendor/riddle/lib/riddle/configuration/section.rb +37 -0
  141. data/vendor/riddle/lib/riddle/configuration/source.rb +23 -0
  142. data/vendor/riddle/lib/riddle/configuration/sql_source.rb +34 -0
  143. data/vendor/riddle/lib/riddle/configuration/xml_source.rb +28 -0
  144. data/vendor/riddle/lib/riddle/controller.rb +44 -0
  145. metadata +248 -0
@@ -0,0 +1,56 @@
1
+ Feature: Keeping AR::Base.find arguments in search calls
2
+ To keep things as streamlined as possible
3
+ Thinking Sphinx
4
+ Should respect particular arguments to AR::Base.find calls
5
+
6
+ Scenario: Respecting the include option
7
+ Given Sphinx is running
8
+ And I am searching on posts
9
+ Then I should get 1 result
10
+
11
+ When I get the first comment
12
+ And I track queries
13
+ And I compare comments
14
+ Then I should have 1 query
15
+
16
+ When I include comments
17
+ Then I should get 1 result
18
+ When I track queries
19
+ And I compare comments
20
+ Then I should have 0 queries
21
+
22
+ Scenario: Respecting the include option without using a specific model
23
+ Given Sphinx is running
24
+ And I search for "Hello World"
25
+ Then I should get 1 result
26
+
27
+ When I get the first comment
28
+ And I track queries
29
+ And I compare comments
30
+ Then I should have 1 query
31
+
32
+ When I include comments
33
+ Then I should get 1 result
34
+ When I track queries
35
+ And I compare comments
36
+ Then I should have 0 queries
37
+
38
+ Scenario: Respecting the select option
39
+ Given Sphinx is running
40
+ And I am searching on posts
41
+ Then I should get 1 result
42
+ And I should not get an error accessing the subject
43
+
44
+ When I select only content
45
+ Then I should get 1 result
46
+ And I should get an error accessing the subject
47
+
48
+ Scenario: Respecting the select option without using a specific model
49
+ Given Sphinx is running
50
+ When I search for "Hello World"
51
+ Then I should get 1 result
52
+ And I should not get an error accessing the subject
53
+
54
+ When I select only content
55
+ Then I should get 1 result
56
+ And I should get an error accessing the subject
@@ -0,0 +1,16 @@
1
+ Feature: Checking whether Sphinx is running or not
2
+ In order to avoid unnecessary errors
3
+ Thinking Sphinx
4
+ Should be able to determine whether Sphinx is running or not
5
+
6
+ Scenario: Checking Sphinx's status
7
+ Given Sphinx is running
8
+ Then Sphinx should be running
9
+
10
+ When I stop Sphinx
11
+ And I wait for Sphinx to catch up
12
+ Then Sphinx should not be running
13
+
14
+ When I start Sphinx
15
+ And I wait for Sphinx to catch up
16
+ Then Sphinx should be running
@@ -0,0 +1,3 @@
1
+ When /^I change the name of alpha (\w+) to (\w+)$/ do |current, replacement|
2
+ Alpha.find_by_name(current).update_attributes(:name => replacement)
3
+ end
@@ -0,0 +1,11 @@
1
+ When /^I destroy beta (\w+)$/ do |name|
2
+ Beta.find_by_name(name).destroy
3
+ end
4
+
5
+ When /^I create a new beta named (\w+)$/ do |name|
6
+ Beta.create(:name => name)
7
+ end
8
+
9
+ When /^I change the name of beta (\w+) to (\w+)$/ do |current, replacement|
10
+ Beta.find_by_name(current).update_attributes(:name => replacement)
11
+ end
@@ -0,0 +1,3 @@
1
+ When /^I destroy cat (\w+)$/ do |name|
2
+ Cat.find_by_name(name).destroy
3
+ end
@@ -0,0 +1,154 @@
1
+ Before do
2
+ $queries_executed = []
3
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
4
+
5
+ @model = nil
6
+ @method = :search
7
+ @query = ""
8
+ @conditions = {}
9
+ @with = {}
10
+ @without = {}
11
+ @with_all = {}
12
+ @options = {}
13
+ end
14
+
15
+ Given /^I am searching on (.+)$/ do |model|
16
+ @model = model.gsub(/\s/, '_').singularize.camelize.constantize
17
+ end
18
+
19
+ When /^I am searching for ids$/ do
20
+ @results = nil
21
+ @method = :search_for_ids
22
+ end
23
+
24
+ When /^I am retrieving the result count$/ do
25
+ @result = nil
26
+ @method = @model ? :search_count : :count
27
+ end
28
+
29
+ When /^I search for (\w+)$/ do |query|
30
+ @results = nil
31
+ @query = query
32
+ end
33
+
34
+ When /^I search for "([^\"]+)"$/ do |query|
35
+ @results = nil
36
+ @query = query
37
+ end
38
+
39
+ When /^I search for (\w+) on (\w+)$/ do |query, field|
40
+ @results = nil
41
+ @conditions[field.to_sym] = query
42
+ end
43
+
44
+ When /^I clear existing filters$/ do
45
+ @with = {}
46
+ @without = {}
47
+ @with_all = {}
48
+ end
49
+
50
+ When /^I filter by (\w+) on (\w+)$/ do |filter, attribute|
51
+ @results = nil
52
+ @with[attribute.to_sym] = filter.to_i
53
+ end
54
+
55
+ When /^I filter by (\d+) and (\d+) on (\w+)$/ do |value_one, value_two, attribute|
56
+ @results = nil
57
+ @with[attribute.to_sym] = [value_one.to_i, value_two.to_i]
58
+ end
59
+
60
+ When /^I filter by both (\d+) and (\d+) on (\w+)$/ do |value_one, value_two, attribute|
61
+ @results = nil
62
+ @with_all[attribute.to_sym] = [value_one.to_i, value_two.to_i]
63
+ end
64
+
65
+ When /^I filter between ([\d\.]+) and ([\d\.]+) on (\w+)$/ do |first, last, attribute|
66
+ @results = nil
67
+ if first[/\./].nil? && last[/\./].nil?
68
+ @with[attribute.to_sym] = first.to_i..last.to_i
69
+ else
70
+ @with[attribute.to_sym] = first.to_f..last.to_f
71
+ end
72
+ end
73
+
74
+ When /^I filter between (\d+) and (\d+) days ago on (\w+)$/ do |last, first, attribute|
75
+ @results = nil
76
+ @with[attribute.to_sym] = first.to_i.days.ago..last.to_i.days.ago
77
+ end
78
+
79
+ When /^I order by (\w+)$/ do |attribute|
80
+ @results = nil
81
+ @options[:order] = attribute.to_sym
82
+ end
83
+
84
+ When /^I order by "([^\"]+)"$/ do |str|
85
+ @results = nil
86
+ @options[:order] = str
87
+ end
88
+
89
+ When /^I group results by the (\w+) attribute$/ do |attribute|
90
+ @results = nil
91
+ @options[:group_function] = :attr
92
+ @options[:group_by] = attribute
93
+ end
94
+
95
+ When /^I set match mode to (\w+)$/ do |match_mode|
96
+ @results = nil
97
+ @options[:match_mode] = match_mode.to_sym
98
+ end
99
+
100
+ When /^I set per page to (\d+)$/ do |per_page|
101
+ @results = nil
102
+ @options[:per_page] = per_page.to_i
103
+ end
104
+
105
+ When /^I set retry stale to (\w+)$/ do |retry_stale|
106
+ @results = nil
107
+ @options[:retry_stale] = case retry_stale
108
+ when "true" then true
109
+ when "false" then false
110
+ else retry_stale.to_i
111
+ end
112
+ end
113
+
114
+ Then /^the (\w+) of each result should indicate order$/ do |attribute|
115
+ results.inject(nil) do |prev, current|
116
+ unless prev.nil?
117
+ current.send(attribute.to_sym).should >= prev.send(attribute.to_sym)
118
+ end
119
+
120
+ current
121
+ end
122
+ end
123
+
124
+ Then /^I can iterate by result and (\w+)$/ do |attribute|
125
+ iteration = lambda { |result, attr_value|
126
+ result.should be_kind_of(@model)
127
+ unless attribute == "group" && attr_value.nil?
128
+ attr_value.should be_kind_of(Integer)
129
+ end
130
+ }
131
+
132
+ results.send("each_with_#{attribute}", &iteration)
133
+ end
134
+
135
+ Then /^I should get (\d+) results?$/ do |count|
136
+ results.length.should == count.to_i
137
+ end
138
+
139
+ Then /^I should not get (\d+) results?$/ do |count|
140
+ results.length.should_not == count.to_i
141
+ end
142
+
143
+ def results
144
+ @results ||= (@model || ThinkingSphinx::Search).send(
145
+ @method,
146
+ @query,
147
+ @options.merge(
148
+ :conditions => @conditions,
149
+ :with => @with,
150
+ :without => @without,
151
+ :with_all => @with_all
152
+ )
153
+ )
154
+ end
@@ -0,0 +1,11 @@
1
+ When /^I index the theta datetime delta$/ do
2
+ Theta.sphinx_indexes.first.delta_object.delayed_index(Theta)
3
+ end
4
+
5
+ When /^I change the name of theta (\w+) to (\w+)$/ do |current, replacement|
6
+ Theta.find_by_name(current).update_attributes(:name => replacement)
7
+ end
8
+
9
+ When /^I create a new theta named (\w+)$/ do |name|
10
+ Theta.create(:name => name)
11
+ end
@@ -0,0 +1,7 @@
1
+ When /^I run the delayed jobs$/ do
2
+ Delayed::Job.work_off.inspect
3
+ end
4
+
5
+ When /^I change the name of delayed beta (\w+) to (\w+)$/ do |current, replacement|
6
+ DelayedBeta.find_by_name(current).update_attributes(:name => replacement)
7
+ end
@@ -0,0 +1,30 @@
1
+ When "I am requesting facet results" do
2
+ @method = :facets
3
+ end
4
+
5
+ When /^I drill down where (\w+) is (\w+)$/ do |facet, value|
6
+ @results = results.for(facet.downcase.to_sym => value)
7
+ end
8
+
9
+ When /^I drill down where (\w+) is (\w+) and (\w+) is (\w+)$/ do |facet_one, value_one, facet_two, value_two|
10
+ value_one = value_one.to_i unless value_one[/^\d+$/].nil?
11
+ value_two = value_two.to_i unless value_two[/^\d+$/].nil?
12
+
13
+ @results = results.for(
14
+ facet_one.downcase.to_sym => value_one,
15
+ facet_two.downcase.to_sym => value_two
16
+ )
17
+ end
18
+
19
+ Then "I should have valid facet results" do
20
+ results.should be_kind_of(Hash)
21
+ results.values.each { |value| value.should be_kind_of(Hash) }
22
+ end
23
+
24
+ Then /^I should have (\d+) facets?$/ do |count|
25
+ results.keys.length.should == count.to_i
26
+ end
27
+
28
+ Then /^I should have the facet (\w+)$/ do |name|
29
+ results[name.downcase.to_sym].should be_kind_of(Hash)
30
+ end
@@ -0,0 +1,36 @@
1
+ When "I include comments" do
2
+ @results = nil
3
+ @options[:include] = :comments
4
+ end
5
+
6
+ When /^I get the first comment$/ do
7
+ @comment = Comment.find(:first)
8
+ end
9
+
10
+ When /^I track queries$/ do
11
+ $queries_executed = []
12
+ end
13
+
14
+ When /^I compare comments$/ do
15
+ results.first.comments.first.should == @comment
16
+ end
17
+
18
+ When /^I select only content$/ do
19
+ @results = nil
20
+ @options[:select] = "id, content"
21
+ end
22
+
23
+ Then /^I should have (\d+) quer[yies]+$/ do |count|
24
+ $queries_executed.length.should == count.to_i
25
+ end
26
+
27
+ Then /^I should not get an error accessing the subject$/ do
28
+ lambda { results.first.subject }.should_not raise_error
29
+ end
30
+
31
+ Then /^I should get an error accessing the subject$/ do
32
+ error_class = NoMethodError
33
+ error_class = ActiveRecord::MissingAttributeError if ActiveRecord.constants.include?("MissingAttributeError")
34
+
35
+ lambda { results.first.subject }.should raise_error(error_class)
36
+ end
@@ -0,0 +1,15 @@
1
+ When /^I destroy gamma (\w+) without callbacks$/ do |name|
2
+ @results = nil
3
+ gamma = Gamma.find_by_name(name)
4
+ Gamma.delete(gamma.id) if gamma
5
+ end
6
+
7
+ Then "I should get a single result of nil" do
8
+ results.should == [nil]
9
+ end
10
+
11
+ Then /^I should get a single gamma result with a name of (\w+)$/ do |name|
12
+ results.length.should == 1
13
+ results.first.should be_kind_of(Gamma)
14
+ results.first.name.should == name
15
+ end
@@ -0,0 +1,66 @@
1
+ When /^I search for the specific id of (\d+) in the (\w+) index$/ do |id, index|
2
+ @id = id.to_i
3
+ @index = index
4
+ end
5
+
6
+ When /^I search for the document id of (\w+) (\w+) in the (\w+) index$/ do |model, name, index|
7
+ model = model.gsub(/\s/, '_').camelize.constantize
8
+ @id = model.find_by_name(name).sphinx_document_id
9
+ @index = index
10
+ end
11
+
12
+ Then "it should exist" do
13
+ ThinkingSphinx::Search.search_for_id(@id, @index).should == true
14
+ end
15
+
16
+ Then "it should not exist" do
17
+ ThinkingSphinx::Search.search_for_id(@id, @index).should == false
18
+ end
19
+
20
+ Then "it should exist if using Rails 2.1 or newer" do
21
+ require 'active_record/version'
22
+ unless ActiveRecord::VERSION::STRING.to_f < 2.1
23
+ ThinkingSphinx::Search.search_for_id(@id, @index).should == true
24
+ end
25
+ end
26
+
27
+ Then "it should not exist if using Rails 2.1 or newer" do
28
+ require 'active_record/version'
29
+ unless ActiveRecord::VERSION::STRING.to_f < 2.1
30
+ ThinkingSphinx::Search.search_for_id(@id, @index).should == false
31
+ end
32
+ end
33
+
34
+ Then /^I can iterate by result and group and count$/ do
35
+ results.each_with_groupby_and_count do |result, group, count|
36
+ result.should be_kind_of(@model)
37
+ count.should be_kind_of(Integer)
38
+ group.should be_kind_of(Integer)
39
+ end
40
+ end
41
+
42
+ Then "each result id should match the corresponding sphinx internal id" do
43
+ results.each_with_sphinx_internal_id do |result, id|
44
+ result.id.should == id
45
+ end
46
+ end
47
+
48
+ Then "I should have an array of integers" do
49
+ results.each do |result|
50
+ result.should be_kind_of(Integer)
51
+ end
52
+ end
53
+
54
+ Then "searching for ids should match the record ids of the normal search results" do
55
+ normal_results = results
56
+
57
+ # reset search, switch method
58
+ @results = nil
59
+ @method = :search_for_ids
60
+
61
+ results.should == normal_results.collect(&:id)
62
+ end
63
+
64
+ Then /^I should get a value of (\d+)$/ do |count|
65
+ results.should == count.to_i
66
+ end
@@ -0,0 +1,23 @@
1
+ Given "Sphinx is running" do
2
+ ThinkingSphinx::Configuration.instance.controller.should be_running
3
+ end
4
+
5
+ When "I wait for Sphinx to catch up" do
6
+ sleep(0.25)
7
+ end
8
+
9
+ When "I start Sphinx" do
10
+ ThinkingSphinx::Configuration.instance.controller.start
11
+ end
12
+
13
+ When "I stop Sphinx" do
14
+ ThinkingSphinx::Configuration.instance.controller.stop
15
+ end
16
+
17
+ Then "Sphinx should be running" do
18
+ ThinkingSphinx.sphinx_running?.should be_true
19
+ end
20
+
21
+ Then "Sphinx should not be running" do
22
+ ThinkingSphinx.sphinx_running?.should be_false
23
+ end