File: around.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 (25 lines) | stat: -rw-r--r-- 451 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
require "./spec/cases/helper"

describe "2" do
  let(:calls) { [] }

  before { calls << 1 }
  around((ENV["HOOK_TYPE"] || "each").to_sym) { |test| calls << 2; test.call }
  around { |test| calls << 3; test.call }
  after  { _(calls).must_equal [1,2,3,4] }
  after  { calls << 4 }

  it "is ordered" do
    _(calls).must_equal [1,2,3]
  end
end

class AroundTest < Minitest::Test
  def around
    yield
  end

  def test_things
    assert 1
  end
end