Sha256: 968385a255e91c8157d56cd4b1f42d683a506e2f14e404792f85c227546f518b

Contents?: true

Size: 1.56 KB

Versions: 74

Compression:

Stored size: 1.56 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| File.delete(file) if File.exist?(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

74 entries across 74 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.39.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.38.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.37.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.36.2 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.36.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.36.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.35.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.34.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.33.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.33.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.32.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.31.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.30.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.29.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.28.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.27.1 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.27.0 spec/integration/generators/blacklight/solr_generator_spec.rb
blacklight-7.26.1 spec/integration/generators/blacklight/solr_generator_spec.rb