Sha256: 995087a701d37e6104d5b18b91dc4bacb063266ce78370c212df4bada9d8b193

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

require 'spec_helper'

describe Riddle::AutoVersion do
  describe '.configure' do
    before :each do
      @controller = Riddle::Controller.new stub('configuration'), 'sphinx.conf'
      Riddle::Controller.stub!(:new => @controller)

      unless ENV['SPHINX_VERSION'].nil?
        @env_version, ENV['SPHINX_VERSION'] = ENV['SPHINX_VERSION'].dup, nil
      end
    end

    after :each do
      ENV['SPHINX_VERSION'] = @env_version unless @env_version.nil?
    end

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

      @controller.stub!(:sphinx_version => '0.9.8')
      Riddle::AutoVersion.configure
    end

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

      @controller.stub!(:sphinx_version => '0.9.9')
      Riddle::AutoVersion.configure
    end

    it "should require 1.10 if that is the known version" do
      Riddle::AutoVersion.should_receive(:require).with('riddle/1.10')

      @controller.stub!(:sphinx_version => '1.10-beta')
      Riddle::AutoVersion.configure
    end

    it "should require 1.10 if using 1.10 with 64 bit IDs" do
      Riddle::AutoVersion.should_receive(:require).with('riddle/1.10')

      @controller.stub!(:sphinx_version => '1.10-id64-beta')
      Riddle::AutoVersion.configure
    end

    it "should require 2.0.1 if that is the known version" do
      Riddle::AutoVersion.should_receive(:require).with('riddle/2.0.1')

      @controller.stub!(:sphinx_version => '2.0.1-beta')
      Riddle::AutoVersion.configure
    end

    it "should require 2.1.0 if that is the known version" do
      Riddle::AutoVersion.should_receive(:require).with('riddle/2.1.0')

      @controller.stub!(:sphinx_version => '2.1.0-dev')
      Riddle::AutoVersion.configure
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riddle-1.5.1 spec/riddle/auto_version_spec.rb