From 4bd16f053847f2efe347ebda9136ef2233ee0d2c Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 28 Apr 2009 00:15:53 +0200 Subject: added thinking_sphinx plugin for fulltext search on nodes and heads --- vendor/plugins/thinking-sphinx/spec/spec_helper.rb | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 vendor/plugins/thinking-sphinx/spec/spec_helper.rb (limited to 'vendor/plugins/thinking-sphinx/spec/spec_helper.rb') 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 @@ +$:.unshift File.dirname(__FILE__) + '/../lib' + +require 'rubygems' +require 'fileutils' +require 'ginger' + +require 'lib/thinking_sphinx' + +require 'not_a_mock' +require 'will_paginate' + +require 'spec/sphinx_helper' + +ActiveRecord::Base.logger = Logger.new(StringIO.new) + +Spec::Runner.configure do |config| + %w( tmp tmp/config tmp/log tmp/db ).each do |path| + FileUtils.mkdir_p "#{Dir.pwd}/#{path}" + end + + Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT) + + sphinx = SphinxHelper.new + sphinx.setup_mysql + + require 'spec/fixtures/models' + + config.before :all do + %w( tmp tmp/config tmp/log tmp/db ).each do |path| + FileUtils.mkdir_p "#{Dir.pwd}/#{path}" + end + + ThinkingSphinx.updates_enabled = true + ThinkingSphinx.deltas_enabled = true + ThinkingSphinx.suppress_delta_output = true + + ThinkingSphinx::Configuration.instance.reset + ThinkingSphinx::Configuration.instance.database_yml_file = "spec/fixtures/sphinx/database.yml" + + # Ensure after_commit plugin is loaded correctly + Object.subclasses_of(ActiveRecord::ConnectionAdapters::AbstractAdapter).each { |klass| + unless klass.ancestors.include?(AfterCommit::ConnectionAdapters) + klass.send(:include, AfterCommit::ConnectionAdapters) + end + } + end + + config.after :each do + NotAMock::CallRecorder.instance.reset + NotAMock::Stubber.instance.reset + end + + config.after :all do + FileUtils.rm_r "#{Dir.pwd}/tmp" rescue nil + end +end -- cgit v1.3