Module: Assert

Defined in:
lib/assert/test.rb,
lib/assert/macro.rb,
lib/assert/suite.rb,
lib/assert/result.rb,
lib/assert/runner.rb,
lib/assert/autorun.rb,
lib/assert/context.rb,
lib/assert/options.rb,
lib/assert/version.rb,
lib/assert/assertions.rb,
lib/assert/rake_tasks.rb,
lib/assert/result_set.rb,
lib/assert/setup/view.rb,
lib/assert/setup/suite.rb,
lib/assert/setup/helpers.rb

Defined Under Namespace

Modules: Assertions, Helpers, Macros, Options, RakeTasks, Result, View Classes: Context, Macro, ResultSet, Runner, Suite, Test

Constant Summary collapse

VERSION =
"0.3.0"
@@view =

Setup the default view to render test results (override in user or package helpers)

View::Terminal.new(self.suite, $stdout)
@@suite =

Setup the default global suite for collecting tests as contexts are defined

Suite.new

Class Method Summary collapse

Class Method Details

.autorunObject

install at_exit hook (if needed) (runs at process exit) this ensures the test suite won’t run unitl all test files are loaded (this is essentially a direct rip from Minitest)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/assert/autorun.rb', line 14

def autorun
  at_exit do
    # don't run if there was an exception
    next if $!

    # the order here is important. The at_exit handler must be
    # installed before anyone else gets a chance to install their
    # own, that way we can be assured that our exit will be last
    # to run (at_exit stacks).

    exit_code = nil
    at_exit { exit(false) if exit_code && exit_code != 0 }
    Runner.new(self.suite, self.view).run
  end unless @@at_exit_installed
  @@at_exit_installed = true
end

.suiteObject



9
# File 'lib/assert/setup/suite.rb', line 9

def suite; @@suite; end

.viewObject



8
# File 'lib/assert/setup/view.rb', line 8

def view; @@view; end