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
dirty_history-0.4.2 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.3.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.3.0 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.3.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.2.0 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.2.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
dirty_history-0.1.3 dirty_history/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb
gemrage-0.4.1 vendor/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb
gemrage-0.4.0 vendor/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb
drake-0.8.7.0.2.4 test/test_test_task.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.10.17 vendor/gems/gems/rake-0.8.7/test/test_test_task.rb
middleman-0.10.16 vendor/gems/gems/rake-0.8.7/test/test_test_task.rb