Skip to content

Commit

Permalink
Sphinx 2.1.0-dev support - via edge Riddle.
Browse files Browse the repository at this point in the history
  • Loading branch information
pat committed Nov 12, 2011
1 parent a73e0b7 commit d3f3b2a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
4 changes: 3 additions & 1 deletion lib/thinking_sphinx/auto_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ def self.detect
require 'riddle/1.10'
when /2.0.\d/
require 'riddle/2.0.1'
when /2.1.\d/
require 'riddle/2.1.0'
else
documentation_link = %Q{
For more information, read the documentation:
http://freelancing-god.github.com/ts/en/advanced_config.html
http://freelancing-god.github.com/ts/en/advanced_config.html
}

if version.nil? || version.empty?
Expand Down
40 changes: 24 additions & 16 deletions spec/thinking_sphinx/auto_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,73 @@
before :each do
@config = ThinkingSphinx::Configuration.instance
end

it "should require 0.9.8 if that is the detected version" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/0.9.8')

@config.stub!(:version => '0.9.8')
ThinkingSphinx::AutoVersion.detect
end

it "should require 0.9.9 if that is the detected version" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/0.9.9')

@config.stub!(:version => '0.9.9')
ThinkingSphinx::AutoVersion.detect
end

it "should require 1.10-beta if that is the detected version" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/1.10')

@config.stub!(:version => '1.10-beta')
ThinkingSphinx::AutoVersion.detect
end

it "should require 1.10-beta if using 1.10-beta compiled with id64 support" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/1.10')

@config.stub!(:version => '1.10-id64-beta')
ThinkingSphinx::AutoVersion.detect
end

it "should require 2.0.1 if using Sphinx 2.0.1 beta" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/2.0.1')

@config.stub!(:version => '2.0.1-beta')
ThinkingSphinx::AutoVersion.detect
end

it "should require 2.0.1 if using Sphinx 2.0.2 dev" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/2.0.1')

@config.stub!(:version => '2.0.2-dev')
ThinkingSphinx::AutoVersion.detect
end


it "should require 2.1.0 if using Sphinx 2.1.0 dev" do
ThinkingSphinx::AutoVersion.should_receive(:require).
with('riddle/2.1.0')

@config.stub!(:version => '2.1.0-dev')
ThinkingSphinx::AutoVersion.detect
end

it "should output a warning if the detected version is unsupported" do
STDERR.should_receive(:puts).with(/unsupported/i)

@config.stub!(:version => '0.9.7')
ThinkingSphinx::AutoVersion.detect
end

it "should output a warning if the version cannot be determined" do
STDERR.should_receive(:puts).at_least(:once)

@config.stub!(:version => nil)
ThinkingSphinx::AutoVersion.detect
end
Expand Down

0 comments on commit d3f3b2a

Please sign in to comment.