Sha256: 3c3779378c010f87843d369f5a450308fe162c7b13b7bb11fc2dde53bb78b023

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

require 'rake'
require 'test/unit'
require 'rake/common/ziptask'
require 'rake/helpers/unittest'

class TestZipTask <  Test::Unit::TestCase
private
public
    def setup
        @rake_task = Rake::Task.new('some-task-' + name, Rake.application)
        @zip = __FILE__.pathmap('%X.zip')
        File.unlink(@zip) if File.exists?(@zip)
    end

    def test_zip_no_task
        assert_raise NoMethodError do
            # first argument must be a Rake::Task
            # "undefined method `application' for nil:NilClass" must be raised
            Rake::Delphi::ZipTask.new(nil, nil, nil)
        end
    end

    def test_zip_no_filename
        assert_raise RuntimeError do
            # second argument must be non-empty
            Rake::Delphi::ZipTask.new(@rake_task, nil, nil)
        end
    end

    def test_zip_empty_filename
        assert_raise RuntimeError do
            # second argument must be non-empty
            Rake::Delphi::ZipTask.new(@rake_task, '', nil)
        end
    end

    def test_zip_file
        Rake::Delphi::ZipTask.new(@rake_task, @zip, [__FILE__])
        assert(File.exists?(@zip))
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake-delphi-0.0.4 test/test-zip.rb