Module: Assert
- Defined in:
- lib/assert.rb,
lib/assert/cli.rb,
lib/assert/stub.rb,
lib/assert/test.rb,
lib/assert/view.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/context_info.rb,
lib/assert/default_view.rb,
lib/assert/view_helpers.rb,
lib/assert/assert_runner.rb,
lib/assert/default_suite.rb,
lib/assert/config_helpers.rb,
lib/assert/default_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, ConfigHelpers, Factory, Macros, Result, RoundedMillisecondTime, Utils, ViewHelpers
Classes: AssertRunner, CLI, CLIRB, Config, Context, ContextInfo, DefaultRunner, DefaultSuite, DefaultView, FileLine, Macro, Runner, Stub, Suite, Test, View
Constant Summary
collapse
- StubError =
Class.new(ArgumentError)
- NotStubbedError =
Class.new(StubError)
- StubArityError =
Class.new(StubError)
- U =
Utils
- VERSION =
"2.16.4"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
13
|
# File 'lib/assert.rb', line 13
def self.config; @config ||= Config.new; end
|
14
|
# File 'lib/assert.rb', line 14
def self.configure; yield self.config if block_given?; end
|
.runner ⇒ Object
18
|
# File 'lib/assert.rb', line 18
def self.runner; self.config.runner; end
|
.stub(obj, meth, &block) ⇒ Object
7
8
9
10
11
|
# File 'lib/assert/stub.rb', line 7
def self.stub(obj, meth, &block)
(self.stubs[Assert::Stub.key(obj, meth)] ||= begin
Assert::Stub.new(obj, meth, caller_locations)
end).tap{ |s| s.do = block }
end
|
.stub_send(obj, meth, *args, &block) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/assert/stub.rb', line 21
def self.stub_send(obj, meth, *args, &block)
orig_caller = caller_locations
stub = self.stubs.fetch(Assert::Stub.key(obj, meth)) do
raise NotStubbedError, "`#{meth}` not stubbed.", orig_caller.map(&:to_s)
end
stub.call_method(args, &block)
end
|
.stubs ⇒ Object
3
4
5
|
# File 'lib/assert/stub.rb', line 3
def self.stubs
@stubs ||= {}
end
|
.suite ⇒ Object
17
|
# File 'lib/assert.rb', line 17
def self.suite; self.config.suite; end
|
.unstub(obj, meth) ⇒ Object
.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
|
.view ⇒ Object
16
|
# File 'lib/assert.rb', line 16
def self.view; self.config.view; end
|