Class: Synthesis::Task

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Logging
Defined in:
lib/synthesis/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#silence!, #speak!

Constructor Details

#initialize(name = 'synthesis:test') {|_self| ... } ⇒ Task

Returns a new instance of Task.

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
16
17
18
19
20
# File 'lib/synthesis/task.rb', line 12

def initialize(name='synthesis:test')
  @name, @ignored, @libs = name, [], []
  yield self if block_given?
  @pattern ||= 'test/**/*_test.rb'
  @ruby_opts ||= []
  @adapter ||= :mocha
  @formatter ||= :text
  define
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def adapter
  @adapter
end

#formatterObject

Returns the value of attribute formatter.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def formatter
  @formatter
end

#formatter_outObject

Returns the value of attribute formatter_out.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def formatter_out
  @formatter_out
end

#ignoredObject

Returns the value of attribute ignored.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def ignored
  @ignored
end

#libsObject

Returns the value of attribute libs.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def libs
  @libs
end

#outObject

Returns the value of attribute out.



10
11
12
# File 'lib/synthesis/task.rb', line 10

def out
  @out
end

#patternObject

Returns the value of attribute pattern.



9
10
11
# File 'lib/synthesis/task.rb', line 9

def pattern
  @pattern
end

#ruby_optsObject

Returns the value of attribute ruby_opts.



9
10
11
# File 'lib/synthesis/task.rb', line 9

def ruby_opts
  @ruby_opts
end

#verboseObject

Returns the value of attribute verbose.



9
10
11
# File 'lib/synthesis/task.rb', line 9

def verbose
  @verbose
end

Instance Method Details

#defineObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/synthesis/task.rb', line 33

def define
  desc "Run Synthesis tests"
  task @name do
    RakeFileUtils.verbose(@verbose) do
      load_paths
      require File.dirname(__FILE__) + "/../synthesis"
      require File.dirname(__FILE__) + "/../synthesis/runner"
      Synthesis::Logging.const_set(:OUT, @out) if @out
      Synthesis::ExpectationRecord.ignore(*@ignored)
      Synthesis::Runner.run(@adapter, @pattern, @formatter, @formatter_out)
    end
  end
  self
end

#ignore(*classes) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/synthesis/task.rb', line 22

def ignore(*classes)
  STDERR.puts
  STDERR.puts "DEPRECATION WARNING!!!"
  STDERR.puts caller[0]
  STDERR.puts "Synthesis::Task#ignore(*classes) has been deprecated."
  STDERR.puts "Use Synthesis::Task#ignored = [#{classes * ','}] instead."
  STDERR.puts
  @ignored << classes
  @ignored.flatten!
end