summaryrefslogtreecommitdiff
path: root/vendor/plugins/thinking-sphinx/spec/spec_helper.rb
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-04-28 00:15:53 +0200
committerhukl <contact@smyck.org>2009-05-01 17:14:02 +0200
commit4bd16f053847f2efe347ebda9136ef2233ee0d2c (patch)
treef4c11f89455de991c8d87726d5757b752e7129e2 /vendor/plugins/thinking-sphinx/spec/spec_helper.rb
parentd3a9b46ba5c863a0ff377dcffae9a494fe476e02 (diff)
added thinking_sphinx plugin for fulltext search on nodes and heads
Diffstat (limited to 'vendor/plugins/thinking-sphinx/spec/spec_helper.rb')
-rw-r--r--vendor/plugins/thinking-sphinx/spec/spec_helper.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/plugins/thinking-sphinx/spec/spec_helper.rb b/vendor/plugins/thinking-sphinx/spec/spec_helper.rb
new file mode 100644
index 0000000..6ebce6d
--- /dev/null
+++ b/vendor/plugins/thinking-sphinx/spec/spec_helper.rb
@@ -0,0 +1,56 @@
1$:.unshift File.dirname(__FILE__) + '/../lib'
2
3require 'rubygems'
4require 'fileutils'
5require 'ginger'
6
7require 'lib/thinking_sphinx'
8
9require 'not_a_mock'
10require 'will_paginate'
11
12require 'spec/sphinx_helper'
13
14ActiveRecord::Base.logger = Logger.new(StringIO.new)
15
16Spec::Runner.configure do |config|
17 %w( tmp tmp/config tmp/log tmp/db ).each do |path|
18 FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
19 end
20
21 Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT)
22
23 sphinx = SphinxHelper.new
24 sphinx.setup_mysql
25
26 require 'spec/fixtures/models'
27
28 config.before :all do
29 %w( tmp tmp/config tmp/log tmp/db ).each do |path|
30 FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
31 end
32
33 ThinkingSphinx.updates_enabled = true
34 ThinkingSphinx.deltas_enabled = true
35 ThinkingSphinx.suppress_delta_output = true
36
37 ThinkingSphinx::Configuration.instance.reset
38 ThinkingSphinx::Configuration.instance.database_yml_file = "spec/fixtures/sphinx/database.yml"
39
40 # Ensure after_commit plugin is loaded correctly
41 Object.subclasses_of(ActiveRecord::ConnectionAdapters::AbstractAdapter).each { |klass|
42 unless klass.ancestors.include?(AfterCommit::ConnectionAdapters)
43 klass.send(:include, AfterCommit::ConnectionAdapters)
44 end
45 }
46 end
47
48 config.after :each do
49 NotAMock::CallRecorder.instance.reset
50 NotAMock::Stubber.instance.reset
51 end
52
53 config.after :all do
54 FileUtils.rm_r "#{Dir.pwd}/tmp" rescue nil
55 end
56end