Sha256: edd8dcf27da41ca09cd575ed87731a4f2759335f2b1766df649e40df60c981c7

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 Bytes

Contents

require "massive_sitemap/writer/gzip_file"

describe MassiveSitemap::Writer::GzipFile do
  let(:filename)      { 'sitemap.xml' }
  let(:tmp_filename)  { "#{filename}.tmp" }
  let(:gz_filename)   { "#{filename}.gz" }

  let(:writer) { MassiveSitemap::Writer::GzipFile.new.tap { |w| w.init! } }

  after do
    writer.each { |path| FileUtils.rm(path.first) rescue nil }
  end

  it 'creates gzip file' do
    expect do
      writer.close!
    end.to change { File.exists?(gz_filename) }.to(true)
  end

  context "with root" do
    let(:root) { "sitemap"}

    let(:writer) { MassiveSitemap::Writer::GzipFile.new(:root => root).tap { |w| w.init! } }

    after do
      FileUtils.rm_rf(root) rescue nil
    end

    it 'creates gzip file in document root' do
      expect do
        writer.close!
      end.to change { File.exists?("sitemap/#{gz_filename}") }.to(true)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
massive_sitemap-2.0.0.rc4 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0.rc3 spec/writer/gzip_file_spec.rb