Sha256: 5c06e62b9ff03fe0f04de0d6a1b06976b0aa52e6e0c8613217ee04ef744f39c6

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

require 'rake/tasklib'

module Rake::Funnel::Tasks
  class NUnit < Rake::TaskLib
    include Rake::Funnel::Support

    attr_accessor :name, :files, :args

    def initialize(name = :test)
      @name = name
      @args = {}
      @files = %w(build/specs/**/*.dll build/specs/**/*.exe)

      yield self if block_given?
      define
    end

    def nunit
      @_nunit || 'nunit-console.exe'
    end

    def nunit=(value)
      @_nunit = value
    end

    private
    def define
      desc "Test #{test_assemblies.all_or_default.join(', ')}"
      task name do
        Rake::Funnel::Integration::TeamCity::NUnitPlugin.setup(nunit)

        cmd = [
          *Mono.invocation(nunit),
          *test_assemblies.all,
          *Mapper.new(:NUnit).map(args)
        ]

        sh(*cmd)
      end

      self
    end

    def test_assemblies
      Finder.new(files, self, 'No test assemblies found.')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake-funnel-0.1.0.pre lib/rake/funnel/tasks/nunit.rb