Sha256: 91148ef6cab5a2069dd0b64cc5287424b94b255ea13906b59f679afb1a394c8b

Contents?: true

Size: 1.66 KB

Versions: 95

Compression:

Stored size: 1.66 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'rake/testtask'

class TestTestTask < Test::Unit::TestCase
  include Rake
  include TestMethods
  
  def setup
    Task.clear
    ENV.delete('TEST')
  end

  def teardown
    FileUtils.rm_rf("testdata")
  end

  def test_no_task
    assert ! Task.task_defined?(:test)
  end

  def test_defaults
    tt = Rake::TestTask.new do |t| end
    assert_not_nil tt
    assert_equal :test, tt.name
    assert_equal ['lib'], tt.libs
    assert_equal 'test/test*.rb', tt.pattern
    assert_equal false, tt.verbose
    assert Task.task_defined?(:test)
  end

  def test_non_defaults
    tt = Rake::TestTask.new(:example) do |t|
      t.libs = ['src', 'ext']
      t.pattern = 'test/tc_*.rb'
      t.verbose = true
    end
    assert_not_nil tt
    assert_equal :example, tt.name
    assert_equal ['src', 'ext'], tt.libs
    assert_equal 'test/tc_*.rb', tt.pattern
    assert_equal true, tt.verbose
    assert Task.task_defined?(:example)
  end

  def test_pattern
    tt = Rake::TestTask.new do |t|
      t.pattern = '*.rb'
    end
    assert_equal ['install.rb'], tt.file_list.to_a
  end

  def test_env_test
    ENV['TEST'] = 'testfile.rb'
    tt = Rake::TestTask.new do |t|
      t.pattern = '*'
    end
    assert_equal ["testfile.rb"], tt.file_list.to_a
  end

  def test_test_files
    tt = Rake::TestTask.new do |t|
      t.test_files = FileList['a.rb', 'b.rb']
    end
    assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
  end

  def test_both_pattern_and_test_files
    tt = Rake::TestTask.new do |t|
      t.test_files = FileList['a.rb', 'b.rb']
      t.pattern = '*.rb'
    end
    assert_equal ['a.rb', 'b.rb', 'install.rb'], tt.file_list.to_a
  end

end

Version data entries

95 entries across 67 versions & 9 rubygems

Version Path
craigmarksmith-rake-0.8.3.100 test/test_test_task.rb
craigmarksmith-rake-0.8.4.101 test/test_test_task.rb
craigmarksmith-rake-0.8.4.102 test/test_test_task.rb
craigmarksmith-rake-0.8.4.103 test/test_test_task.rb
jimweirich-rake-0.8.3.100 test/test_test_task.rb
jimweirich-rake-0.8.3.99 test/test_test_task.rb
jimweirich-rake-0.8.4.99 test/test_test_task.rb
jimweirich-rake-0.8.5 test/test_test_task.rb
luislavena-rake-0.8.3.99 test/test_test_task.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb