Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Forced commit - start of a fix to multimodel searching

  • Loading branch information...
commit dc95153cebf2a081628833ef7a8466ef854ded70 1 parent 47a37de
@pat pat authored
View
15 spec/spec_helper.rb
@@ -9,26 +9,23 @@
require 'spec/sphinx_helper'
Spec::Runner.configure do |config|
- # config.mock_with NotAMock::RspecMockFrameworkAdapter
+ %w( tmp tmp/config tmp/log tmp/db ).each do |path|
+ FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
+ end
sphinx = SphinxHelper.new
sphinx.setup_mysql
- require 'spec/fixtures/models'
- # puts "Models:", ThinkingSphinx.indexed_models
+ 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
-
+ config.before :all do
Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT)
sphinx.setup_sphinx
sphinx.start
end
- config.before :each do
+ config.after :each do
NotAMock::CallRecorder.instance.reset
NotAMock::Stubber.instance.reset
end
View
4 spec/sphinx_helper.rb
@@ -75,9 +75,9 @@ def index
def start
return if running?
-
+
cmd = "searchd --config #{@configuration.config_file}"
- `#{cmd}`
+ `#{cmd}`
sleep(1)
View
2  spec/unit/thinking_sphinx/active_record_spec.rb
@@ -21,7 +21,7 @@ class TestModel < ActiveRecord::Base; end
# Remove the class so we can redefine it
TestModule.send(:remove_const, :TestModel)
- ThinkingSphinx::Index.unstub_method(:new)
+ ThinkingSphinx.indexed_models.delete "TestModule::TestModel"
end
it "should return nil and do nothing if indexes are disabled" do
View
16 spec/unit/thinking_sphinx/configuration_spec.rb
@@ -81,8 +81,8 @@ module Merb; end
Person.unstub_method :indexes
Friendship.unstub_method :indexes
-
- FileUtils.rm_rf "#{@config.app_root}/config"
+ #
+ # FileUtils.rm_rf "#{@config.app_root}/config"
end
it "should load the models" do
@@ -239,9 +239,7 @@ module Merb; end
describe "core_index_for_model method" do
before :each do
@config = ThinkingSphinx::Configuration.new
- @model = Class.stub_instance(
- :indexes => [ThinkingSphinx::Index.new(Person)]
- )
+ @model = Person
end
it "should take its name from the model, with _core appended" do
@@ -399,9 +397,7 @@ module Merb; end
describe "delta_index_for_model method" do
before :each do
@config = ThinkingSphinx::Configuration.new
- @model = Class.stub_instance(
- :indexes => [ThinkingSphinx::Index.new(Person)]
- )
+ @model = Person
end
it "should take its name from the model, with _delta appended" do
@@ -427,9 +423,7 @@ module Merb; end
describe "distributed_index_for_model method" do
before :each do
@config = ThinkingSphinx::Configuration.new
- @model = Class.stub_instance(
- :indexes => [ThinkingSphinx::Index.new(Person)]
- )
+ @model = Person
end
it "should take its name from the model" do
Please sign in to comment.
Something went wrong with that request. Please try again.