Class: EacRedmineBase0::PluginsTest

Inherits:
Object
  • Object
show all
Includes:
EacRubyUtils::Console::Speaker
Defined in:
lib/eac_redmine_base0/plugins_test.rb,
lib/eac_redmine_base0/plugins_test/plugin.rb,
lib/eac_redmine_base0/plugins_test/base_test.rb,
lib/eac_redmine_base0/plugins_test/rubocop_test.rb,
lib/eac_redmine_base0/plugins_test/rake_task_test.rb,
lib/eac_redmine_base0/plugins_test/unmaintened_stub_test.rb

Defined Under Namespace

Classes: BaseTest, Plugin, RakeTaskTest, RubocopTest, UnmaintenedStubTest

Instance Method Summary collapse

Instance Method Details

#check_plugin(plugin) ⇒ Object



18
19
20
# File 'lib/eac_redmine_base0/plugins_test.rb', line 18

def check_plugin(plugin)
  ::EacRedmineBase0::PluginsTest::Plugin.new(plugin).tests.each { |test| check_test(test) }
end

#check_resultsObject



41
42
43
44
45
46
47
48
# File 'lib/eac_redmine_base0/plugins_test.rb', line 41

def check_results
  if tests_failed.any?
    fatal_error "Some test did not pass:\n" +
                tests_failed.map { |test| "  * #{test} (Log: #{test.stdout_log})" }.join("\n")
  else
    success 'All tests passed'
  end
end

#check_test(test) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/eac_redmine_base0/plugins_test.rb', line 22

def check_test(test)
  infom "Checking test \"#{test}\"..."
  test.test_result
  infom "Test \"#{test}\" checked"
  @tests << test
  results_banner
end

#results_bannerObject



30
31
32
33
34
35
# File 'lib/eac_redmine_base0/plugins_test.rb', line 30

def results_banner
  infom 'Tests\' results:'
  @tests.each do |test|
    infov "  * #{test}", test.test_result.label
  end
end

#runObject



10
11
12
13
14
15
16
# File 'lib/eac_redmine_base0/plugins_test.rb', line 10

def run
  @tests = []
  ::Redmine::Plugin.registered_plugins.each_value do |plugin|
    check_plugin(plugin)
  end
  check_results
end

#tests_failedObject



37
38
39
# File 'lib/eac_redmine_base0/plugins_test.rb', line 37

def tests_failed
  @tests.select { |test| test.test_result.error? }
end