class Fudge::Tasks::Cucumber

Allow use of Cucumber as a task

Private Instance Methods

check_for() click to toggle source
Calls superclass method
# File lib/fudge/tasks/cucumber.rb, line 9
def check_for
  if coverage
    [check_regex, method(:coverage_checker)]
  else
    super
  end
end
check_regex() click to toggle source
# File lib/fudge/tasks/cucumber.rb, line 17
def check_regex
  /((\d+\.\d+)%\) covered)/
end
cmd(options={}) click to toggle source
# File lib/fudge/tasks/cucumber.rb, line 46
def cmd(options={})
  self.arguments = 'features/' if (arguments.nil? || arguments.empty?)
  bundle_cmd("cucumber#{color_options} #{arguments}", options)
end
color() click to toggle source
# File lib/fudge/tasks/cucumber.rb, line 51
def color
  options[:color]
end
color_options() click to toggle source
# File lib/fudge/tasks/cucumber.rb, line 42
def color_options
  ' --color' unless color == false
end
coverage() click to toggle source
# File lib/fudge/tasks/cucumber.rb, line 21
def coverage
  options[:coverage]
end
coverage_checker(matches) click to toggle source

checks if the expected coverage is met

# File lib/fudge/tasks/cucumber.rb, line 26
def coverage_checker(matches)
  matches = matches.to_s
  test_coverage_threshold(matches)
end
test_coverage_threshold(matches) click to toggle source

checks the matched string from the console output, to see if the number for the coverage is greater or equal than the expected coverage

# File lib/fudge/tasks/cucumber.rb, line 34
def test_coverage_threshold(matches)
  if matches.to_f >= coverage
    true
  else
    'Insufficient Coverage.'
  end
end