Class: EacRedmineBase0::PluginsTest

Inherits:
Object
  • Object
show all
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



22
23
24
# File 'lib/eac_redmine_base0/plugins_test.rb', line 22

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

#check_resultsObject



45
46
47
48
49
50
51
52
53
# File 'lib/eac_redmine_base0/plugins_test.rb', line 45

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

#check_test(test) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/eac_redmine_base0/plugins_test.rb', line 26

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

#results_bannerObject



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

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

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/eac_redmine_base0/plugins_test.rb', line 12

def run
  ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new) do
    @tests = []
    ::Redmine::Plugin.registered_plugins.each_value do |plugin|
      check_plugin(plugin)
    end
    check_results
  end
end

#tests_failedObject



41
42
43
# File 'lib/eac_redmine_base0/plugins_test.rb', line 41

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