class Mutiny::Mode::Check

Public Instance Methods

run() click to toggle source
# File lib/mutiny/mode/check.rb, line 6
def run
  report "Checking..."

  if relevant_test_set.empty?
    report_invalid

  elsif test_run.passed?
    report_valid

  else
    report_warning
  end
end

Private Instance Methods

complete_test_set() click to toggle source
# File lib/mutiny/mode/check.rb, line 57
def complete_test_set
  @complete_test_set ||= configuration.integration.tests.filterable(environment.subjects)
end
failed_test_locations() click to toggle source
# File lib/mutiny/mode/check.rb, line 49
def failed_test_locations
  test_run.failed_tests.locations
end
pattern_string() click to toggle source
# File lib/mutiny/mode/check.rb, line 45
def pattern_string
  configuration.patterns.join(',')
end
relevant_test_set() click to toggle source
# File lib/mutiny/mode/check.rb, line 53
def relevant_test_set
  @test_set ||= complete_test_set.for_all(environment.subjects)
end
report_invalid() click to toggle source
# File lib/mutiny/mode/check.rb, line 22
def report_invalid
  report "  No relevant tests found (for modules matching '#{pattern_string}')"
  report "Either your mutiny configuration is wrong, or you're missing some tests!"
end
report_valid() click to toggle source
# File lib/mutiny/mode/check.rb, line 39
def report_valid
  report "  At least one relevant test found (#{relevant_test_set.size} in total)"
  report "  All relevant tests passed"
  report "Looks good!"
end
report_warning() click to toggle source
# File lib/mutiny/mode/check.rb, line 27
def report_warning
  report "  At least one relevant test found (#{relevant_test_set.size} in total)"
  report "  Not all relevant tests passed. The failing tests are:\n"

  failed_test_locations.each do |location|
    report "    #{location}"
  end

  report ""
  report "Looks ok, but note that mutiny is most effective when all tests pass."
end
test_run() click to toggle source
# File lib/mutiny/mode/check.rb, line 61
def test_run
  @test_run ||= configuration.integration.run(relevant_test_set)
end