Module: Assay
- Defined in:
- lib/assay.rb,
lib/assay/bang.rb,
lib/assay/version.rb,
lib/assay/assertor.rb,
lib/assay/minitest.rb,
lib/assay/assertable.rb,
lib/assay/ae/assertor.rb,
lib/assay/rspec/matchers.rb,
lib/assay/adapter/minitest.rb,
lib/assay/adapter/testunit.rb,
lib/assay/fluidity/grammar.rb,
lib/assay/minitest/assertions.rb,
lib/assay/minitest/extensions.rb,
lib/assay/testunit/assertions.rb
Defined Under Namespace
Modules: AE, Adapter, Assertable, Assertions, Bang, Extensions, Fluidity, Matchers, MiniTest, RSpec, TestUnit Classes: Assertor
Constant Summary collapse
- VERSION =
'0.5.1'- Minitest =
Minitestis how the framework spells its name now. MiniTest
Class Method Summary collapse
-
.assertions ⇒ Object
Returns a list of Assertion subclasses.
-
.color=(boolean) ⇒ Object
Set ANSI color mode.
-
.color_diff(a, b) ⇒ Array<String>
Two inspected values with the differences between them colored, for failure messages when color is on.
-
.lookup(symbol) ⇒ Object
Lookup assay class by operator or name.
-
.lookup_by_name(name = nil) ⇒ Object
If operator is not given, returns a hash table of assertion classes indexed by assertive name.
-
.lookup_by_operator(operator = nil) ⇒ Object
If operator is not given, returns a hash table of assertion classes indexed by operator.
Class Method Details
.assertions ⇒ Object
Returns a list of Assertion subclasses.
17 18 19 |
# File 'lib/assay.rb', line 17 def self.assertions Assertion.subclasses end |
.color=(boolean) ⇒ Object
Set ANSI color mode. Default is false, so set to true to get ANSI color
in some error messages.
28 29 30 31 32 33 34 35 |
# File 'lib/assay.rb', line 28 def self.color=(boolean) if boolean require 'ansi/diff' $ansi = true else $ansi = false end end |
.color_diff(a, b) ⇒ Array<String>
Two inspected values with the differences between them colored, for
failure messages when color is on. Color can be turned on from
outside Assay (the ANSI gem sets $ansi when it loads), so the diff
library is loaded here, where it is used.
45 46 47 48 49 |
# File 'lib/assay.rb', line 45 def self.color_diff(a, b) require 'ansi/diff' diff = ::ANSI::Diff.new(a, b) return diff.diff1, diff.diff2 end |
.lookup(symbol) ⇒ Object
Lookup assay class by operator or name.
54 55 56 |
# File 'lib/assay.rb', line 54 def self.lookup(symbol) lookup_by_operator(symbol) || lookup_by_name(symbol) end |
.lookup_by_name(name = nil) ⇒ Object
If operator is not given, returns a hash table of assertion classes indexed by assertive name.
70 71 72 |
# File 'lib/assay.rb', line 70 def self.lookup_by_name(name=nil) Assertion.by_name(name) end |
.lookup_by_operator(operator = nil) ⇒ Object
If operator is not given, returns a hash table of assertion classes indexed by operator.
62 63 64 |
# File 'lib/assay.rb', line 62 def self.lookup_by_operator(operator=nil) Assertion.by_operator(operator) end |