thinking-sphinx 1.2.13 → 1.4.0

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 (204) hide show
  1. data/README.textile +37 -4
  2. data/VERSION +1 -0
  3. data/features/abstract_inheritance.feature +10 -0
  4. data/features/alternate_primary_key.feature +1 -1
  5. data/features/attribute_updates.feature +49 -5
  6. data/features/deleting_instances.feature +3 -0
  7. data/features/excerpts.feature +8 -0
  8. data/features/facets.feature +15 -1
  9. data/features/facets_across_model.feature +2 -2
  10. data/features/field_sorting.feature +18 -0
  11. data/features/handling_edits.feature +1 -1
  12. data/features/searching_across_models.feature +2 -2
  13. data/features/searching_by_index.feature +40 -0
  14. data/features/searching_by_model.feature +1 -8
  15. data/features/sphinx_scopes.feature +33 -0
  16. data/features/step_definitions/alpha_steps.rb +14 -1
  17. data/features/step_definitions/beta_steps.rb +1 -1
  18. data/features/step_definitions/common_steps.rb +21 -2
  19. data/features/step_definitions/facet_steps.rb +4 -0
  20. data/features/step_definitions/scope_steps.rb +8 -0
  21. data/features/step_definitions/search_steps.rb +5 -0
  22. data/features/step_definitions/sphinx_steps.rb +8 -4
  23. data/features/sti_searching.feature +5 -0
  24. data/features/support/env.rb +7 -6
  25. data/features/{support → thinking_sphinx}/db/fixtures/betas.rb +1 -0
  26. data/features/{support → thinking_sphinx}/db/fixtures/comments.rb +1 -1
  27. data/features/{support → thinking_sphinx}/db/fixtures/developers.rb +2 -0
  28. data/features/thinking_sphinx/db/fixtures/foxes.rb +3 -0
  29. data/features/thinking_sphinx/db/fixtures/music.rb +4 -0
  30. data/features/{support → thinking_sphinx}/db/fixtures/people.rb +1 -1
  31. data/features/{support → thinking_sphinx}/db/fixtures/tags.rb +1 -1
  32. data/features/{support → thinking_sphinx}/db/migrations/create_alphas.rb +1 -0
  33. data/features/{support → thinking_sphinx}/db/migrations/create_developers.rb +0 -2
  34. data/features/thinking_sphinx/db/migrations/create_genres.rb +3 -0
  35. data/features/thinking_sphinx/db/migrations/create_music.rb +6 -0
  36. data/features/thinking_sphinx/models/alpha.rb +23 -0
  37. data/features/thinking_sphinx/models/andrew.rb +17 -0
  38. data/features/{support → thinking_sphinx}/models/beta.rb +1 -1
  39. data/features/{support → thinking_sphinx}/models/developer.rb +2 -2
  40. data/features/{support → thinking_sphinx}/models/extensible_beta.rb +1 -1
  41. data/features/thinking_sphinx/models/fox.rb +5 -0
  42. data/features/thinking_sphinx/models/genre.rb +3 -0
  43. data/features/thinking_sphinx/models/medium.rb +5 -0
  44. data/features/thinking_sphinx/models/music.rb +8 -0
  45. data/features/{support → thinking_sphinx}/models/person.rb +2 -1
  46. data/features/{support → thinking_sphinx}/models/post.rb +2 -1
  47. data/lib/cucumber/thinking_sphinx/external_world.rb +12 -0
  48. data/lib/cucumber/thinking_sphinx/internal_world.rb +13 -11
  49. data/lib/thinking_sphinx/active_record/attribute_updates.rb +17 -15
  50. data/lib/thinking_sphinx/active_record/delta.rb +0 -26
  51. data/lib/thinking_sphinx/active_record/has_many_association.rb +34 -11
  52. data/lib/thinking_sphinx/active_record/scopes.rb +46 -3
  53. data/lib/thinking_sphinx/active_record.rb +271 -193
  54. data/lib/thinking_sphinx/adapters/abstract_adapter.rb +45 -9
  55. data/lib/thinking_sphinx/adapters/mysql_adapter.rb +5 -1
  56. data/lib/thinking_sphinx/adapters/postgresql_adapter.rb +9 -1
  57. data/lib/thinking_sphinx/attribute.rb +67 -23
  58. data/lib/thinking_sphinx/auto_version.rb +24 -0
  59. data/lib/thinking_sphinx/bundled_search.rb +44 -0
  60. data/lib/thinking_sphinx/class_facet.rb +3 -2
  61. data/lib/thinking_sphinx/configuration.rb +78 -64
  62. data/lib/thinking_sphinx/context.rb +76 -0
  63. data/lib/thinking_sphinx/deltas/default_delta.rb +14 -20
  64. data/lib/thinking_sphinx/deltas.rb +0 -2
  65. data/lib/thinking_sphinx/deploy/capistrano.rb +1 -1
  66. data/lib/thinking_sphinx/excerpter.rb +1 -1
  67. data/lib/thinking_sphinx/facet.rb +6 -5
  68. data/lib/thinking_sphinx/facet_search.rb +54 -24
  69. data/lib/thinking_sphinx/field.rb +2 -4
  70. data/lib/thinking_sphinx/index/builder.rb +36 -20
  71. data/lib/thinking_sphinx/index/faux_column.rb +8 -0
  72. data/lib/thinking_sphinx/index.rb +77 -19
  73. data/lib/thinking_sphinx/join.rb +37 -0
  74. data/lib/thinking_sphinx/property.rb +9 -2
  75. data/lib/thinking_sphinx/rails_additions.rb +4 -4
  76. data/lib/thinking_sphinx/search.rb +212 -66
  77. data/lib/thinking_sphinx/search_methods.rb +22 -4
  78. data/lib/thinking_sphinx/source/internal_properties.rb +2 -2
  79. data/lib/thinking_sphinx/source/sql.rb +5 -3
  80. data/lib/thinking_sphinx/source.rb +21 -12
  81. data/lib/thinking_sphinx/tasks.rb +26 -58
  82. data/lib/thinking_sphinx/test.rb +55 -0
  83. data/lib/thinking_sphinx.rb +70 -38
  84. data/rails/init.rb +4 -2
  85. data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record/delta_spec.rb +6 -8
  86. data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record/has_many_association_spec.rb +26 -3
  87. data/spec/thinking_sphinx/active_record/scopes_spec.rb +176 -0
  88. data/spec/thinking_sphinx/active_record_spec.rb +618 -0
  89. data/spec/thinking_sphinx/adapters/abstract_adapter_spec.rb +134 -0
  90. data/spec/{lib/thinking_sphinx → thinking_sphinx}/association_spec.rb +1 -1
  91. data/spec/{lib/thinking_sphinx → thinking_sphinx}/attribute_spec.rb +87 -46
  92. data/spec/thinking_sphinx/auto_version_spec.rb +47 -0
  93. data/spec/{lib/thinking_sphinx → thinking_sphinx}/configuration_spec.rb +73 -63
  94. data/spec/thinking_sphinx/context_spec.rb +127 -0
  95. data/spec/{lib/thinking_sphinx → thinking_sphinx}/core/array_spec.rb +1 -1
  96. data/spec/{lib/thinking_sphinx → thinking_sphinx}/core/string_spec.rb +1 -1
  97. data/spec/{lib/thinking_sphinx → thinking_sphinx}/excerpter_spec.rb +1 -9
  98. data/spec/{lib/thinking_sphinx → thinking_sphinx}/facet_search_spec.rb +76 -82
  99. data/spec/{lib/thinking_sphinx → thinking_sphinx}/facet_spec.rb +5 -5
  100. data/spec/{lib/thinking_sphinx → thinking_sphinx}/field_spec.rb +1 -42
  101. data/spec/{lib/thinking_sphinx → thinking_sphinx}/index/builder_spec.rb +71 -31
  102. data/spec/{lib/thinking_sphinx → thinking_sphinx}/index/faux_column_spec.rb +8 -2
  103. data/spec/thinking_sphinx/index_spec.rb +183 -0
  104. data/spec/{lib/thinking_sphinx → thinking_sphinx}/rails_additions_spec.rb +5 -5
  105. data/spec/{lib/thinking_sphinx → thinking_sphinx}/search_methods_spec.rb +5 -1
  106. data/spec/{lib/thinking_sphinx → thinking_sphinx}/search_spec.rb +183 -31
  107. data/spec/{lib/thinking_sphinx → thinking_sphinx}/source_spec.rb +18 -2
  108. data/spec/thinking_sphinx/test_spec.rb +20 -0
  109. data/spec/thinking_sphinx_spec.rb +204 -0
  110. data/tasks/distribution.rb +7 -26
  111. data/tasks/testing.rb +32 -20
  112. metadata +488 -147
  113. data/VERSION.yml +0 -5
  114. data/features/datetime_deltas.feature +0 -66
  115. data/features/delayed_delta_indexing.feature +0 -37
  116. data/features/step_definitions/datetime_delta_steps.rb +0 -15
  117. data/features/step_definitions/delayed_delta_indexing_steps.rb +0 -7
  118. data/features/support/database.yml +0 -5
  119. data/features/support/db/active_record.rb +0 -40
  120. data/features/support/db/database.yml +0 -5
  121. data/features/support/db/fixtures/delayed_betas.rb +0 -10
  122. data/features/support/db/fixtures/thetas.rb +0 -10
  123. data/features/support/db/migrations/create_delayed_betas.rb +0 -17
  124. data/features/support/db/migrations/create_thetas.rb +0 -5
  125. data/features/support/db/mysql.rb +0 -3
  126. data/features/support/db/postgresql.rb +0 -3
  127. data/features/support/models/alpha.rb +0 -10
  128. data/features/support/models/delayed_beta.rb +0 -7
  129. data/features/support/models/theta.rb +0 -7
  130. data/features/support/post_database.rb +0 -43
  131. data/lib/thinking_sphinx/deltas/datetime_delta.rb +0 -50
  132. data/lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb +0 -24
  133. data/lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb +0 -27
  134. data/lib/thinking_sphinx/deltas/delayed_delta/job.rb +0 -26
  135. data/lib/thinking_sphinx/deltas/delayed_delta.rb +0 -30
  136. data/spec/lib/thinking_sphinx/active_record/scopes_spec.rb +0 -96
  137. data/spec/lib/thinking_sphinx/active_record_spec.rb +0 -353
  138. data/spec/lib/thinking_sphinx/deltas/job_spec.rb +0 -32
  139. data/spec/lib/thinking_sphinx/index_spec.rb +0 -45
  140. data/spec/lib/thinking_sphinx_spec.rb +0 -162
  141. data/vendor/after_commit/LICENSE +0 -20
  142. data/vendor/after_commit/README +0 -16
  143. data/vendor/after_commit/Rakefile +0 -22
  144. data/vendor/after_commit/init.rb +0 -8
  145. data/vendor/after_commit/lib/after_commit/active_record.rb +0 -114
  146. data/vendor/after_commit/lib/after_commit/connection_adapters.rb +0 -103
  147. data/vendor/after_commit/lib/after_commit.rb +0 -45
  148. data/vendor/after_commit/test/after_commit_test.rb +0 -53
  149. data/vendor/delayed_job/lib/delayed/job.rb +0 -251
  150. data/vendor/delayed_job/lib/delayed/message_sending.rb +0 -7
  151. data/vendor/delayed_job/lib/delayed/performable_method.rb +0 -55
  152. data/vendor/delayed_job/lib/delayed/worker.rb +0 -54
  153. data/vendor/riddle/lib/riddle/client/filter.rb +0 -53
  154. data/vendor/riddle/lib/riddle/client/message.rb +0 -66
  155. data/vendor/riddle/lib/riddle/client/response.rb +0 -84
  156. data/vendor/riddle/lib/riddle/client.rb +0 -635
  157. data/vendor/riddle/lib/riddle/configuration/distributed_index.rb +0 -48
  158. data/vendor/riddle/lib/riddle/configuration/index.rb +0 -142
  159. data/vendor/riddle/lib/riddle/configuration/indexer.rb +0 -19
  160. data/vendor/riddle/lib/riddle/configuration/remote_index.rb +0 -17
  161. data/vendor/riddle/lib/riddle/configuration/searchd.rb +0 -25
  162. data/vendor/riddle/lib/riddle/configuration/section.rb +0 -43
  163. data/vendor/riddle/lib/riddle/configuration/source.rb +0 -23
  164. data/vendor/riddle/lib/riddle/configuration/sql_source.rb +0 -34
  165. data/vendor/riddle/lib/riddle/configuration/xml_source.rb +0 -28
  166. data/vendor/riddle/lib/riddle/configuration.rb +0 -33
  167. data/vendor/riddle/lib/riddle/controller.rb +0 -53
  168. data/vendor/riddle/lib/riddle.rb +0 -30
  169. data/features/{support → thinking_sphinx}/database.example.yml +0 -0
  170. data/features/{support → thinking_sphinx}/db/fixtures/alphas.rb +0 -0
  171. data/features/{support → thinking_sphinx}/db/fixtures/authors.rb +0 -0
  172. data/features/{support → thinking_sphinx}/db/fixtures/boxes.rb +0 -0
  173. data/features/{support → thinking_sphinx}/db/fixtures/categories.rb +0 -0
  174. data/features/{support → thinking_sphinx}/db/fixtures/cats.rb +0 -0
  175. data/features/{support → thinking_sphinx}/db/fixtures/dogs.rb +0 -0
  176. data/features/{support → thinking_sphinx}/db/fixtures/extensible_betas.rb +0 -0
  177. data/features/{support → thinking_sphinx}/db/fixtures/gammas.rb +0 -0
  178. data/features/{support → thinking_sphinx}/db/fixtures/posts.rb +0 -0
  179. data/features/{support → thinking_sphinx}/db/fixtures/robots.rb +0 -0
  180. data/features/{support → thinking_sphinx}/db/migrations/create_animals.rb +0 -0
  181. data/features/{support → thinking_sphinx}/db/migrations/create_authors.rb +0 -0
  182. data/features/{support → thinking_sphinx}/db/migrations/create_authors_posts.rb +0 -0
  183. data/features/{support → thinking_sphinx}/db/migrations/create_betas.rb +0 -0
  184. data/features/{support → thinking_sphinx}/db/migrations/create_boxes.rb +0 -0
  185. data/features/{support → thinking_sphinx}/db/migrations/create_categories.rb +0 -0
  186. data/features/{support → thinking_sphinx}/db/migrations/create_comments.rb +0 -0
  187. data/features/{support → thinking_sphinx}/db/migrations/create_extensible_betas.rb +0 -0
  188. data/features/{support → thinking_sphinx}/db/migrations/create_gammas.rb +0 -0
  189. data/features/{support → thinking_sphinx}/db/migrations/create_people.rb +0 -0
  190. data/features/{support → thinking_sphinx}/db/migrations/create_posts.rb +0 -0
  191. data/features/{support → thinking_sphinx}/db/migrations/create_robots.rb +0 -0
  192. data/features/{support → thinking_sphinx}/db/migrations/create_taggings.rb +0 -0
  193. data/features/{support → thinking_sphinx}/db/migrations/create_tags.rb +0 -0
  194. data/features/{support → thinking_sphinx}/models/animal.rb +0 -0
  195. data/features/{support → thinking_sphinx}/models/author.rb +0 -0
  196. data/features/{support → thinking_sphinx}/models/box.rb +0 -0
  197. data/features/{support → thinking_sphinx}/models/cat.rb +0 -0
  198. data/features/{support → thinking_sphinx}/models/category.rb +0 -0
  199. data/features/{support → thinking_sphinx}/models/comment.rb +3 -3
  200. /data/features/{support → thinking_sphinx}/models/dog.rb +0 -0
  201. /data/features/{support → thinking_sphinx}/models/gamma.rb +0 -0
  202. /data/features/{support → thinking_sphinx}/models/robot.rb +0 -0
  203. /data/features/{support → thinking_sphinx}/models/tag.rb +0 -0
  204. /data/features/{support → thinking_sphinx}/models/tagging.rb +0 -0
@@ -0,0 +1,204 @@
1
+ require 'spec_helper'
2
+
3
+ describe ThinkingSphinx do
4
+ describe '.context' do
5
+ it "should return a Context instance" do
6
+ ThinkingSphinx.context.should be_a(ThinkingSphinx::Context)
7
+ end
8
+
9
+ it "should remember changes to the Context instance" do
10
+ models = ThinkingSphinx.context.indexed_models
11
+
12
+ ThinkingSphinx.context.indexed_models.replace([:model])
13
+ ThinkingSphinx.context.indexed_models.should == [:model]
14
+
15
+ ThinkingSphinx.context.indexed_models.replace(models)
16
+ end
17
+ end
18
+
19
+ describe '.reset_context!' do
20
+ it "should remove the existing Context instance" do
21
+ existing = ThinkingSphinx.context
22
+
23
+ ThinkingSphinx.reset_context!
24
+ ThinkingSphinx.context.should_not == existing
25
+
26
+ Thread.current[:thinking_sphinx_context] = existing
27
+ end
28
+ end
29
+
30
+ describe '.define_indexes?' do
31
+ it "should define indexes by default" do
32
+ ThinkingSphinx.define_indexes?.should be_true
33
+ end
34
+ end
35
+
36
+ describe '.define_indexes=' do
37
+ it "should disable index definition" do
38
+ ThinkingSphinx.define_indexes = false
39
+ ThinkingSphinx.define_indexes?.should be_false
40
+ end
41
+
42
+ it "should enable index definition" do
43
+ ThinkingSphinx.define_indexes = false
44
+ ThinkingSphinx.define_indexes?.should be_false
45
+ ThinkingSphinx.define_indexes = true
46
+ ThinkingSphinx.define_indexes?.should be_true
47
+ end
48
+ end
49
+
50
+ describe '.deltas_enabled?' do
51
+ it "should index deltas by default" do
52
+ ThinkingSphinx.deltas_enabled = nil
53
+ ThinkingSphinx.deltas_enabled?.should be_true
54
+ end
55
+ end
56
+
57
+ describe '.deltas_enabled=' do
58
+ it "should disable delta indexing" do
59
+ ThinkingSphinx.deltas_enabled = false
60
+ ThinkingSphinx.deltas_enabled?.should be_false
61
+ end
62
+
63
+ it "should enable delta indexing" do
64
+ ThinkingSphinx.deltas_enabled = false
65
+ ThinkingSphinx.deltas_enabled?.should be_false
66
+ ThinkingSphinx.deltas_enabled = true
67
+ ThinkingSphinx.deltas_enabled?.should be_true
68
+ end
69
+ end
70
+
71
+ describe '.updates_enabled?' do
72
+ it "should update indexes by default" do
73
+ ThinkingSphinx.updates_enabled = nil
74
+ ThinkingSphinx.updates_enabled?.should be_true
75
+ end
76
+ end
77
+
78
+ describe '.updates_enabled=' do
79
+ it "should disable index updating" do
80
+ ThinkingSphinx.updates_enabled = false
81
+ ThinkingSphinx.updates_enabled?.should be_false
82
+ end
83
+
84
+ it "should enable index updating" do
85
+ ThinkingSphinx.updates_enabled = false
86
+ ThinkingSphinx.updates_enabled?.should be_false
87
+ ThinkingSphinx.updates_enabled = true
88
+ ThinkingSphinx.updates_enabled?.should be_true
89
+ end
90
+ end
91
+
92
+ describe '.sphinx_running?' do
93
+ it "should always say Sphinx is running if flagged as being on a remote machine" do
94
+ ThinkingSphinx.remote_sphinx = true
95
+ ThinkingSphinx.stub!(:sphinx_running_by_pid? => false)
96
+
97
+ ThinkingSphinx.sphinx_running?.should be_true
98
+ end
99
+
100
+ it "should actually pay attention to Sphinx if not on a remote machine" do
101
+ ThinkingSphinx.remote_sphinx = false
102
+ ThinkingSphinx.stub!(:sphinx_running_by_pid? => false)
103
+ ThinkingSphinx.sphinx_running?.should be_false
104
+
105
+ ThinkingSphinx.stub!(:sphinx_running_by_pid? => true)
106
+ ThinkingSphinx.sphinx_running?.should be_true
107
+ end
108
+ end
109
+
110
+ describe '.version' do
111
+ it "should return the version from the stored YAML file" do
112
+ version = Jeweler::VersionHelper.new(
113
+ File.join(File.dirname(__FILE__), '..')
114
+ ).to_s
115
+
116
+ ThinkingSphinx.version.should == version
117
+ end
118
+ end
119
+
120
+ describe "use_group_by_shortcut? method" do
121
+ before :each do
122
+ adapter = defined?(JRUBY_VERSION) ? :JdbcAdapter : :MysqlAdapter
123
+ unless ::ActiveRecord::ConnectionAdapters.const_defined?(adapter)
124
+ pending "No MySQL"
125
+ return
126
+ end
127
+
128
+ @connection = stub('adapter',
129
+ :select_all => true,
130
+ :class => ActiveRecord::ConnectionAdapters::MysqlAdapter,
131
+ :config => {:adapter => defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql'}
132
+ )
133
+ ::ActiveRecord::Base.stub!(
134
+ :connection => @connection
135
+ )
136
+
137
+ Thread.current[:thinking_sphinx_use_group_by_shortcut] = nil
138
+ end
139
+
140
+ it "should return true if no ONLY_FULL_GROUP_BY" do
141
+ @connection.stub!(
142
+ :select_all => {:a => "OTHER SETTINGS"}
143
+ )
144
+
145
+ ThinkingSphinx.use_group_by_shortcut?.should be_true
146
+ end
147
+
148
+ it "should return true if NULL value" do
149
+ @connection.stub!(
150
+ :select_all => {:a => nil}
151
+ )
152
+
153
+ ThinkingSphinx.use_group_by_shortcut?.should be_true
154
+ end
155
+
156
+ it "should return false if ONLY_FULL_GROUP_BY is set" do
157
+ @connection.stub!(
158
+ :select_all => {:a => "OTHER SETTINGS,ONLY_FULL_GROUP_BY,blah"}
159
+ )
160
+
161
+ ThinkingSphinx.use_group_by_shortcut?.should be_false
162
+ end
163
+
164
+ it "should return false if ONLY_FULL_GROUP_BY is set in any of the values" do
165
+ @connection.stub!(
166
+ :select_all => {
167
+ :a => "OTHER SETTINGS",
168
+ :b => "ONLY_FULL_GROUP_BY"
169
+ }
170
+ )
171
+
172
+ ThinkingSphinx.use_group_by_shortcut?.should be_false
173
+ end
174
+
175
+ describe "if not using MySQL" do
176
+ before :each do
177
+ adapter = defined?(JRUBY_VERSION) ? 'JdbcAdapter' : 'PostgreSQLAdapter'
178
+ unless ::ActiveRecord::ConnectionAdapters.const_defined?(adapter)
179
+ pending "No PostgreSQL"
180
+ return
181
+ end
182
+
183
+ @connection = stub(adapter).as_null_object
184
+ @connection.stub!(
185
+ :select_all => true,
186
+ :config => {:adapter => defined?(JRUBY_VERSION) ? 'jdbcpostgresql' : 'postgresql'}
187
+ )
188
+ ::ActiveRecord::Base.stub!(
189
+ :connection => @connection
190
+ )
191
+ end
192
+
193
+ it "should return false" do
194
+ ThinkingSphinx.use_group_by_shortcut?.should be_false
195
+ end
196
+
197
+ it "should not call select_all" do
198
+ @connection.should_not_receive(:select_all)
199
+
200
+ ThinkingSphinx.use_group_by_shortcut?
201
+ end
202
+ end
203
+ end
204
+ end
@@ -1,10 +1,5 @@
1
- require 'yard'
2
- require 'jeweler'
3
-
4
1
  desc 'Generate documentation'
5
- YARD::Rake::YardocTask.new do |t|
6
- # t.title = 'Thinking Sphinx - ActiveRecord Sphinx Plugin'
7
- end
2
+ YARD::Rake::YardocTask.new
8
3
 
9
4
  Jeweler::Tasks.new do |gem|
10
5
  gem.name = "thinking-sphinx"
@@ -22,32 +17,18 @@ Jeweler::Tasks.new do |gem|
22
17
  "README.textile",
23
18
  "tasks/**/*.rb",
24
19
  "tasks/**/*.rake",
25
- "vendor/**/*",
26
- "VERSION.yml"
20
+ "VERSION"
27
21
  ]
28
22
  gem.test_files = FileList[
29
- "features/**/*",
23
+ "features/**/*.rb",
24
+ "features/**/*.feature",
25
+ "features/**/*.example.yml",
30
26
  "spec/**/*_spec.rb"
31
27
  ]
32
28
 
33
- gem.add_dependency 'activerecord', '>= 1.15.6'
34
-
35
29
  gem.post_install_message = <<-MESSAGE
36
- With the release of Thinking Sphinx 1.1.18, there is one important change to
37
- note: previously, the default morphology for indexing was 'stem_en'. The new
38
- default is nil, to avoid any unexpected behavior. If you wish to keep the old
39
- value though, you will need to add the following settings to your
40
- config/sphinx.yml file:
41
-
42
- development:
43
- morphology: stem_en
44
- test:
45
- morphology: stem_en
46
- production:
47
- morphology: stem_en
48
-
49
- To understand morphologies/stemmers better, visit the following link:
50
- http://www.sphinxsearch.com/docs/manual-0.9.8.html#conf-morphology
30
+ If you're upgrading, you should read this:
31
+ http://freelancing-god.github.com/ts/en/upgrading.html
51
32
 
52
33
  MESSAGE
53
34
  end
data/tasks/testing.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'rubygems'
2
- require 'spec/rake/spectask'
2
+ require 'rspec/core/rake_task'
3
3
  require 'cucumber/rake/task'
4
4
 
5
5
  desc "Run the specs under spec"
6
- Spec::Rake::SpecTask.new do |t|
7
- t.spec_files = FileList['spec/**/*_spec.rb']
8
- t.spec_opts << "-c"
6
+ RSpec::Core::RakeTask.new do |t|
7
+ t.pattern = 'spec/**/*_spec.rb'
9
8
  end
9
+ task :spec => :check_dependencies
10
10
 
11
11
  desc "Run all feature-set configurations"
12
12
  task :features do |t|
@@ -26,38 +26,50 @@ namespace :features do
26
26
 
27
27
  add_task :mysql, "Run feature-set against MySQL"
28
28
  add_task :postgresql, "Run feature-set against PostgreSQL"
29
- end
30
-
31
- desc "Generate RCov reports"
32
- Spec::Rake::SpecTask.new(:rcov) do |t|
33
- t.libs << 'lib'
34
- t.spec_files = FileList['spec/**/*_spec.rb']
35
- t.rcov = true
36
- t.rcov_opts = [
37
- '--exclude', 'spec',
38
- '--exclude', 'gems',
39
- '--exclude', 'riddle',
40
- '--exclude', 'ruby'
41
- ]
29
+
30
+ task :mysql => :check_dependencies
31
+ task :postgresql => :check_dependencies
42
32
  end
43
33
 
44
34
  namespace :rcov do
35
+ desc "Generate RCov reports"
36
+ RSpec::Core::RakeTask.new(:rspec) do |t|
37
+ t.pattern = 'spec/**/*_spec.rb'
38
+ t.rcov = true
39
+ t.rcov_opts = [
40
+ '--exclude', 'spec',
41
+ '--exclude', 'gems',
42
+ '--exclude', 'riddle',
43
+ '--exclude', 'ruby',
44
+ '--aggregate coverage.data'
45
+ ]
46
+ end
47
+
45
48
  def add_task(name, description)
46
49
  Cucumber::Rake::Task.new(name, description) do |t|
47
- t.cucumber_opts = "--format pretty"
48
- t.profile = name
50
+ t.cucumber_opts = "--format pretty features/*.feature DATABASE=#{name}"
49
51
  t.rcov = true
50
52
  t.rcov_opts = [
51
53
  '--exclude', 'spec',
52
54
  '--exclude', 'gems',
53
55
  '--exclude', 'riddle',
54
- '--exclude', 'features'
56
+ '--exclude', 'features',
57
+ '--aggregate coverage.data'
55
58
  ]
56
59
  end
57
60
  end
58
61
 
59
62
  add_task :mysql, "Run feature-set against MySQL with rcov"
60
63
  add_task :postgresql, "Run feature-set against PostgreSQL with rcov"
64
+
65
+ task :all do
66
+ rm 'coverage.data' if File.exist?('coverage.data')
67
+ rm 'rerun.txt' if File.exist?('rerun.txt')
68
+
69
+ Rake::Task['rcov:rspec'].invoke
70
+ Rake::Task['rcov:mysql'].invoke
71
+ Rake::Task['rcov:postgresql'].invoke
72
+ end
61
73
  end
62
74
 
63
75
  desc "Build cucumber.yml file"