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:



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

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

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



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

def adapter
  @adapter
end

#ignoredObject

Returns the value of attribute ignored.



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

def ignored
  @ignored
end

#outObject

Returns the value of attribute out.



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

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



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

def define
  desc "Run Synthesis tests"
  task @name do
    RakeFileUtils.verbose(@verbose) do
      @ruby_opts.unshift("-w") if @warning
      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)
    end
  end
  self
end

#ignore(*classes) ⇒ Object



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

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