Sha256: f35d370aa88c31127199517565e4801e93740cd36dfba2cdb164bdbab0315f12

Contents?: true

Size: 1.71 KB

Versions: 7

Compression:

Stored size: 1.71 KB

Contents

require "spec_helper"

describe Sunspot::Solr::Server do

  describe ".new" do
    it "ensures Java is installed upon initialization" do
      expect(Sunspot::Solr::Java).to receive(:ensure_install!)
      described_class.new
    end
  end

  describe "#bootstrap" do
    it "installs the solr home directory if it doesn't yet exist" do
      specified_dir = Dir.mktmpdir + "/test_directory"
      subject.solr_home = specified_dir
      expect(Sunspot::Solr::Installer).to receive(:execute).
        with(specified_dir, force: true, verbose: true)
      subject.bootstrap
    end
  end

  describe "#run" do
    before { expect(subject).to receive(:bootstrap) }

    it 'runs the Solr server in the foreground' do
      expect(subject).to receive(:system).with("./solr", "start", "-f", any_args)
      subject.run
    end

    it 'runs the Solr server with the memory specified' do
      subject.memory = 2048
      expect(subject).to receive(:system).with("./solr", "start", "-f", "-m", "2048", any_args)
      subject.run
    end

    it 'runs the Solr server with the port specified' do
      subject.port = 8981
      expect(subject).to receive(:system).with("./solr", "start", "-f", "-p", "8981", any_args)
      subject.run
    end

    it 'runs the Solr server with the hostname specified' do
      subject.bind_address = "0.0.0.0"
      expect(subject).to receive(:system).with("./solr", "start", "-f", "-h", "0.0.0.0", any_args)
      subject.run
    end

    it 'runs the Solr server with the solr home directory specified' do
      specified_dir = Dir.mktmpdir + "/test_directory"
      subject.solr_home = specified_dir
      expect(subject).to receive(:system).with(any_args, "-s", specified_dir)
      subject.run
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sunspot_solr-2.7.1 spec/server_spec.rb
sunspot_solr-2.7.0 spec/server_spec.rb
sunspot_solr-2.6.0 spec/server_spec.rb
sunspot_solr-2.5.0 spec/server_spec.rb
sunspot_solr-2.4.0 spec/server_spec.rb
sunspot_solr-2.3.0 spec/server_spec.rb
sunspot_solr-2.2.8 spec/server_spec.rb