Method: Rake::FitTask#define

Defined in:
lib/fittask.rb

#define(task_name) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/fittask.rb', line 80

def define task_name
  # describe the fit task
  desc "Run FIT acceptance tests"
  task task_name
  # silence footnote creation since we don't want HTML reports
  task task_name do
    Fit::Parse.send(:define_method, 'footnote', lambda {''})
  end
  # define a fit task for each test suite
  test_suites.each do |suite|
    task task_name do
      @tests_failed = true unless suite.run_tests
    end
  end      

  task task_name do 
     raise 'Tests failed.' if @fail_on_failed_test && @tests_failed
  end

  # describe the fit_report task
  desc "Run FIT acceptance tests with HTML reports"
  task_report_name = (task_name.to_s + '_report').to_sym
  task task_report_name
  # define a fit_report task for each test suite
  test_suites.each do |suite|
    task task_report_name do
      # set footnote path to an appropriate location
      Fit::Parse.footnote_path = suite.report_path
      # run tests
      @tests_failed = true unless suite.run_tests_with_reports
    end
  end

  task task_report_name do 
    raise 'Tests failed.' if @fail_on_failed_test && @tests_failed
  end

  self
end