• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

damphyr / rutema / f1ae38b6-e899-4ddf-81ed-85625e5eab49

26 Mar 2026 10:22AM UTC coverage: 86.45%. First build
f1ae38b6-e899-4ddf-81ed-85625e5eab49

Pull #51

circleci

damphyr
CI status badge
Pull Request #51: Modernize code base

569 of 684 new or added lines in 17 files covered. (83.19%)

906 of 1048 relevant lines covered (86.45%)

10.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.78
/test/test_engine.rb
1
#  Copyright (c) 2021 Vassilis Rizopoulos. All rights reserved.
2

3
require "test/unit"
2✔
4
require "ostruct"
2✔
5
require "mocha/test_unit"
2✔
6
require_relative "../lib/rutema/core/engine"
2✔
7
require_relative "../lib/rutema/core/objectmodel"
2✔
8
require_relative "../lib/rutema/parsers/xml"
2✔
9

10
module TestRutema
2✔
11
  class MockRunner
2✔
12
    attr_accessor :setup, :teardown
2✔
13

14
    def initialize(config)
2✔
15
    end
16

17
    def run(_name, _scenario)
2✔
NEW
18
      return
×
19
    end
20
  end
21

22
  # rubocop:disable Style/ClassVars
23
  class MockReporter < Rutema::Reporters::EventReporter
2✔
24
    def run!
2✔
25
      @@updates = 0
8✔
26
      super
8✔
27
    end
28

29
    # rubocop:disable Lint/UnusedMethodArgument
30
    def update(data)
2✔
31
      # p data
32
      @@updates += 1
44✔
33
    end
34
    # rubocop:enable Lint/UnusedMethodArgument
35

36
    def self.updates
2✔
37
      return @@updates
4✔
38
    end
39
  end
40

41
  # rubocop:enable Style/ClassVars
42
  class TestEngine < Test::Unit::TestCase
2✔
43
    def test_checks
2✔
44
      conf = {}
2✔
45
      assert_raise(NoMethodError) { Rutema::Engine.new(conf) }
4✔
46
      conf = OpenStruct.new(:parser => {}, :runner => {})
2✔
47
      assert_raise(Rutema::RutemaError) { Rutema::Engine.new(conf) }
4✔
48
    end
49

50
    def test_run
2✔
51
      conf = OpenStruct.new(:parser => { :class => Rutema::Parsers::XML },
2✔
52
                            :reporters => { MockReporter => { :class => MockReporter } },
53
                            :tools => {},
54
                            :paths => {},
55
                            :tests => ["#{__dir__}/data/sample.spec"],
56
                            :context => {})
57
      engine = Rutema::Engine.new(conf)
2✔
58
      engine.run
2✔
59
      assert_equal(8, MockReporter.updates)
2✔
60

61
      conf[:tests] = ["#{__dir__}/data/sample.spec", "#{__dir__}/data/duplicate_name.spec"]
2✔
62
      assert_raise(Rutema::ParserError) do
2✔
63
        engine = Rutema::Engine.new(conf)
2✔
64
        engine.run
2✔
65
      end
66
      sleep(0.1)
2✔
67
      assert_equal(2, MockReporter.updates)
2✔
68

69
      conf[:tests] = []
2✔
70
      assert_raise(Rutema::RutemaError) do
2✔
71
        engine = Rutema::Engine.new(conf)
2✔
72
        engine.run
2✔
73
      end
74

75
      conf[:tests] = ["#{__dir__}/data/sample.spec"]
2✔
76
      conf[:setup] = "#{__dir__}/data/setup.spec"
2✔
77
      engine = Rutema::Engine.new(conf)
2✔
78
      engine.run("#{__dir__}/data/sample.spec")
2✔
79
    end
80
  end
81
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc