In Files

Hoe::Test

Test plugin for hoe.

Tasks Provided:

audit

Run ZenTest against the package.

default

Run the default task(s).

multi

Run the test suite using multiruby.

test

Run the test suite.

test_deps

Show which test files fail when run alone.

Constants

SUPPORTED_TEST_FRAMEWORKS

Configuration for the supported test frameworks for test task.

FILTER

Used to add flags to test_unit (e.g., -n test_borked).

eg FILTER=”-n test_blah“

Attributes

multiruby_skip[RW]

Optional: Array of incompatible versions for multiruby filtering. Used as a regex.

testlib[RW]

Optional: What test library to require [default: :testunit]

rspec_dirs[RW]

Optional: RSpec dirs. [default: %w(spec lib)]

rspec_options[RW]

Optional: RSpec options. [default: []]

Public Instance Methods

define_test_tasks() click to toggle source

Define tasks for plugin.

     # File lib/hoe/test.rb, line 62
 62:   def define_test_tasks
 63:     default_tasks = []
 64: 
 65:     if File.directory? "test" then
 66:       desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'
 67:       task :test do
 68:         ruby make_test_cmd
 69:       end
 70: 
 71:       desc 'Run the test suite using multiruby.'
 72:       task :multi do
 73:         ruby make_test_cmd(:multi)
 74:       end
 75: 
 76:       desc 'Show which test files fail when run alone.'
 77:       task :test_deps do
 78:         tests = Dir["test/**/test_*.rb"]  +  Dir["test/**/*_test.rb"]
 79: 
 80:         paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)
 81:         null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'
 82: 
 83:         tests.each do |test|
 84:           if not system "ruby -I#{paths} #{test} #{null_dev}" then
 85:             puts "Dependency Issues: #{test}"
 86:           end
 87:         end
 88:       end
 89: 
 90:       default_tasks << :test
 91:     end
 92: 
 93:     if File.directory? "spec" then
 94:       begin
 95:         require 'spec/rake/spectask'
 96: 
 97:         desc "Run all specifications"
 98:         Spec::Rake::SpecTask.new(:spec) do |t|
 99:           t.libs = self.rspec_dirs
100:           t.spec_opts = self.rspec_options
101:         end
102:       rescue LoadError
103:         # do nothing
104:       end
105:       default_tasks << :spec
106:     end
107: 
108:     desc 'Run the default task(s).'
109:     task :default => default_tasks
110: 
111:     desc 'Run ZenTest against the package.'
112:     task :audit do
113:       libs = %(lib test ext).join(File::PATH_SEPARATOR)
114:       sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
115:     end
116:   end
initialize_test() click to toggle source

Initialize variables for plugin.

    # File lib/hoe/test.rb, line 52
52:   def initialize_test
53:     self.multiruby_skip ||= []
54:     self.testlib        ||= :testunit
55:     self.rspec_dirs     ||= %(spec lib)
56:     self.rspec_options  ||= []
57:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.