Class: Rake::TestTask
- Inherits:
-
Object
- Object
- Rake::TestTask
- Defined in:
- lib/rails_parallel/rake.rb
Constant Summary collapse
- @@patched =
false
Instance Method Summary collapse
- #define(describe = true) ⇒ Object
-
#initialize(name = :test) {|_self| ... } ⇒ TestTask
constructor
A new instance of TestTask.
Constructor Details
#initialize(name = :test) {|_self| ... } ⇒ TestTask
Returns a new instance of TestTask.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/rails_parallel/rake.rb', line 174 def initialize(name=:test) if name.kind_of? Hash @name = name.keys.first @depends = name.values.first else @name = name @depends = [] end @full_name = [Rake.application.current_scope, @name].join(':') @libs = ["lib"] @pattern = nil @options = nil @test_files = nil @verbose = false @warning = false @loader = :rake @ruby_opts = [] yield self if block_given? @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil? if !@@patched && self.class.name == 'TestTaskWithoutDescription' TestTaskWithoutDescription.class_eval { def define; super(false); end } @@patched = true end define end |
Instance Method Details
#define(describe = true) ⇒ Object
203 204 205 206 207 208 209 210 211 |
# File 'lib/rails_parallel/rake.rb', line 203 def define(describe = true) lib_path = @libs.join(File::PATH_SEPARATOR) desc "Run tests" + (@full_name == :test ? "" : " for #{@name}") if describe task @name => @depends do files = file_list.map {|f| f =~ /[\*\?\[\]]/ ? FileList[f] : f }.flatten(1) RailsParallel::Rake.run(@full_name, ruby_opts, files) end self end |