Sha256: 1c7be0fbfe44d548c0bc3b44b8ae3840fed11a3769d26aa3557f963aa86d53db

Contents?: true

Size: 1.54 KB

Versions: 21

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'generators/blacklight/solr_generator'

RSpec.describe Blacklight::SolrGenerator do
  let(:destination) { Dir.mktmpdir }

  describe "#solr_wrapper_config" do
    let(:generator) { described_class.new }
    let(:files_to_test) do
      [
        File.join(destination.to_s, '.solr_wrapper.yml')
      ]
    end

    before do
      generator.destination_root = destination
      generator.solr_wrapper_config
    end

    after do
      files_to_test.each { |file| FileUtils.rm_rf(file) }
    end

    it "creates config files" do
      files_to_test.each do |file|
        expect(File).to exist(file), "Expected #{file} to exist"
      end
    end
  end

  describe "#copy_solr_conf" do
    let(:generator) { described_class.new }
    let(:dirs_to_test) do
      [
        File.join(destination.to_s, 'solr'),
        File.join(destination.to_s, 'solr/conf')
      ]
    end
    let(:files_to_test) do
      [
        File.join(destination.to_s, 'solr/conf/solrconfig.xml')
      ]
    end

    before do
      generator.destination_root = destination
      generator.copy_solr_conf
    end

    after do
      dirs_to_test.each { |dir| FileUtils.rm_rf(Dir.glob(dir)) if File.directory?(dir) }
    end

    it "creates solr directory" do
      dirs_to_test.each do |dir|
        expect(File).to exist(dir), "Expected #{dir} to exist"
      end
    end

    it "copies solr config files" do
      files_to_test.each do |file|
        expect(File).to exist(file), "Expected #{file} to exist"
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.6.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.5.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.5.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.4.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.3.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.2.2 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.2.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.2.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.1.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta8 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta7 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta6 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta5 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta4 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta3 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-8.0.0.beta2 spec/integration/generators/blacklight/solr_generator_spec.rb