File: static_class_order.rb

package info (click to toggle)
ruby-maxitest 6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 504 kB
  • sloc: ruby: 1,583; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 649 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Maxitest
  class << self
    attr_accessor :static_class_order
  end
end

class << Minitest::Runnable
  alias_method :runnables_without_static_order, :runnables

  def runnables
    return runnables_without_static_order unless Maxitest.static_class_order

    #   Minitest.__run uses Runnable.runnables.shuffle -> hack it
    runnables = runnables_without_static_order
    def runnables.shuffle
      self
    end

    # ugly hack to fight minitest 5.10 https://github.com/seattlerb/minitest/commit/478e3f9cfeb0a2f8cc4b029bbcbe7bb16648dd96
    def runnables.reject(*args, &block)
      reject!(*args, &block)
    end

    runnables
  end
end