File: global_must.rb

package info (click to toggle)
ruby-maxitest 7.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 444 kB
  • sloc: ruby: 1,339; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 484 bytes parent folder | download
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
27
28
29
30
# frozen_string_literal: true
if ENV['GLOBAL_MUST']
  require 'maxitest/global_must'
end

require "./spec/cases/helper"

describe "threads" do
  def assert_it
    1.must_equal 1
  end

  it "can assert normal" do
    assert_it
  end

  it "fails" do
    ENV["FAIL"].must_be_nil
  end

  it "can assert in threads" do
    result = "not called"
    Thread.new do
      assert_it
    rescue NotImplementedError
      result = "error"
    end.join
    result.must_equal "error"
  end
end