Sha256: 3ba3cf8b45c6795e29a207ab9b8f4eb582648e20b3ecc157fea428cce6375e4f

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../example_helper')

describe Astrails::Safe::Gzip do

  def def_backup
    {
      :compressed => false,
      :command => "command",
      :extension => ".foo",
      :filename => "qweqwe"
    }
  end

  after(:each) { Astrails::Safe::TmpFile.cleanup }

  def gzip(config = {}, backup = def_backup)
    Astrails::Safe::Gzip.new(
      @config = Astrails::Safe::Config::Node.new(nil, config),
      @backup = Astrails::Safe::Backup.new(backup)
    )
  end

  describe :preocess do

    describe "when not yet compressed" do
      before(:each) { @gzip = gzip }

      it "should add .gz extension" do
        mock(@backup.extension) << '.gz'
        @gzip.process
      end

      it "should add |gzip pipe" do
        mock(@backup.command) << '|gzip'
        @gzip.process
      end

      it "should set compressed" do
        mock(@backup).compressed = true
        @gzip.process
      end
    end

    describe "when already compressed" do

      before(:each) { @gzip = gzip({}, :compressed => true) }

      it "should not touch extension" do
        dont_allow(@backup.extension).<< anything
        @gzip.process
      end

      it "should not touch command" do
        dont_allow(@backup.command).<< anything
        @gzip.process
      end

      it "should not touch compressed" do
        dont_allow(@backup).compressed = anything
        @gzip.process
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
astrails-safe-0.1.10 examples/unit/gzip_example.rb
astrails-safe-0.1.7 examples/unit/gzip_example.rb
astrails-safe-0.1.8 examples/unit/gzip_example.rb
astrails-safe-0.1.9 examples/unit/gzip_example.rb
astrails-safe-0.2.0 examples/unit/gzip_example.rb
astrails-safe-0.2.1 examples/unit/gzip_example.rb
astrails-safe-0.2.2 examples/unit/gzip_example.rb
astrails-safe-0.2.3 examples/unit/gzip_example.rb
bostonlogic-safe-0.3.0 examples/unit/gzip_example.rb
astrails-safe-0.2.7 examples/unit/gzip_example.rb
astrails-safe-0.2.6 examples/unit/gzip_example.rb
astrails-safe-0.2.5 examples/unit/gzip_example.rb
webbynode-safe-0.2.5 examples/unit/gzip_example.rb
astrails-safe-0.2.4 examples/unit/gzip_example.rb