Sha256: 4d8255baba317fc54aa5a5094079fe23e35af7246ac805337b8aae43164308a0

Contents?: true

Size: 928 Bytes

Versions: 7

Compression:

Stored size: 928 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! } }

  context "without root" do
    after do
      writer.each { |path| FileUtils.rm(path.first) }
    end

    it 'creates gzip file' do
      expect do
        writer.close!
      end.to change { ::File.exists?(gz_filename) }.to(true)
    end
  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

7 entries across 7 versions & 1 rubygems

Version Path
massive_sitemap-2.1.1 spec/writer/gzip_file_spec.rb
massive_sitemap-2.1.0 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0.rc8 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0.rc7 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0.rc6 spec/writer/gzip_file_spec.rb
massive_sitemap-2.0.0.rc5 spec/writer/gzip_file_spec.rb