Module: Assert

Defined in:
lib/assert.rb,
lib/assert/cli.rb,
lib/assert/stub.rb,
lib/assert/test.rb,
lib/assert/macro.rb,
lib/assert/suite.rb,
lib/assert/utils.rb,
lib/assert/config.rb,
lib/assert/result.rb,
lib/assert/runner.rb,
lib/assert/context.rb,
lib/assert/factory.rb,
lib/assert/version.rb,
lib/assert/file_line.rb,
lib/assert/assertions.rb,
lib/assert/assert_runner.rb,
lib/assert/context/test_dsl.rb,
lib/assert/context/setup_dsl.rb,
lib/assert/context/suite_dsl.rb,
lib/assert/context/subject_dsl.rb

Defined Under Namespace

Modules: Assertions, Factory, Macros, Result, RoundedMillisecondTime, Utils, View Classes: AssertRunner, CLI, CLIRB, Config, Context, FileLine, Macro, Runner, Stub, Suite, Test

Constant Summary collapse

StubError =
Class.new(ArgumentError)
NotStubbedError =
Class.new(StubError)
StubArityError =
Class.new(StubError)
U =

alias for brevity

Utils
VERSION =
"2.13.0"

Class Method Summary collapse

Class Method Details

.configObject


13
# File 'lib/assert.rb', line 13

def self.config; @config ||= Config.new; end

.configure {|self.config| ... } ⇒ Object

Yields:


14
# File 'lib/assert.rb', line 14

def self.configure; yield self.config if block_given?; end

.runnerObject


18
# File 'lib/assert.rb', line 18

def self.runner; self.config.runner; end

.stub(*args, &block) ⇒ Object


7
8
9
10
11
# File 'lib/assert/stub.rb', line 7

def self.stub(*args, &block)
  (self.stubs[Assert::Stub.key(*args)] ||= Assert::Stub.new(*args)).tap do |s|
    s.do = block
  end
end

.stubsObject


3
4
5
# File 'lib/assert/stub.rb', line 3

def self.stubs
  @stubs ||= {}
end

.suiteObject


17
# File 'lib/assert.rb', line 17

def self.suite;  self.config.suite;  end

.unstub(*args) ⇒ Object


13
14
15
# File 'lib/assert/stub.rb', line 13

def self.unstub(*args)
  (self.stubs.delete(Assert::Stub.key(*args)) || Assert::Stub::NullStub.new).teardown
end

.unstub!Object


17
18
19
# File 'lib/assert/stub.rb', line 17

def self.unstub!
  self.stubs.keys.each{ |key| self.stubs.delete(key).teardown }
end

.viewObject


16
# File 'lib/assert.rb', line 16

def self.view;   self.config.view;   end