basic_assert 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/lib/basic_assert/version.rb +1 -1
- data/lib/basic_assert.rb +0 -18
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a045a53ee42f454f6d16e224ea6578add4a635b1
|
4
|
+
data.tar.gz: 7a14210ce52a550976c15d25d0636c519d095078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b86ed236d610a53af1142d82042276cf7c9a5b559f656f9318c1924797329915852a7eae7ffbe006ee2ba364c0d8a60b8d8eda35c0b5efe7f60535c4377b748
|
7
|
+
data.tar.gz: 5f7c4327f06dce0296e6a4edd1152f625d0f423e6c8c23a1869393555b016263402ada8968df388c8653c5fb917f25ef575cb6d27a0eb1227036d50e464b87e7
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ gem 'basic_assert'
|
|
12
12
|
|
13
13
|
## What's this for ?
|
14
14
|
|
15
|
-
TODO: add rationale
|
15
|
+
TODO: add rationale
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
@@ -34,13 +34,24 @@ end
|
|
34
34
|
|
35
35
|
or define your own asserting policies and side effects, or override them for the given `self` where appropriate.
|
36
36
|
|
37
|
+
Then, you may add you're precondition checks accordingly:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# plain variants:
|
41
|
+
assert condition
|
42
|
+
assert condition, message
|
43
|
+
|
44
|
+
# block variants, the asserter tells when/if the condition gets evaluated:
|
45
|
+
assert { condition block }
|
46
|
+
assert(message) { condition block }
|
47
|
+
```
|
48
|
+
|
37
49
|
An *asserter* is a concern exposing an `assert()` function responsible of evaluating the given condition; a *raiser* is a concern exposing an `assert_raise()` function responsible of managing the actual condition failure.
|
38
50
|
|
39
51
|
Currently, the following asserters and raisers are defined:
|
40
52
|
- `BasicAsserter`: exposes plain and block versions, with or without message
|
41
53
|
- `NoopAsserter`: does nothing, blocks are never evaluated in this case
|
42
|
-
- `ExceptionRaiser`: raises an `ExceptionRaiser::AssertionException`
|
43
|
-
|
54
|
+
- `ExceptionRaiser`: raises an `ExceptionRaiser::AssertionException`; this extends `Exception` and should not be rescued by user code.
|
44
55
|
|
45
56
|
## Development
|
46
57
|
|
data/lib/basic_assert/version.rb
CHANGED
data/lib/basic_assert.rb
CHANGED
@@ -2,21 +2,3 @@ require 'basic_assert/version'
|
|
2
2
|
require 'basic_assert/exception_raiser'
|
3
3
|
require 'basic_assert/basic_asserter'
|
4
4
|
require 'basic_assert/noop_asserter'
|
5
|
-
|
6
|
-
# require_relative '../../lib/asserts'
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
# basic_assert
|
11
|
-
#
|
12
|
-
# assert_raise
|
13
|
-
#
|
14
|
-
# case Rails.configuration.assert_mode
|
15
|
-
# when :raise
|
16
|
-
# include Asserts::ExceptionRaiser
|
17
|
-
# include Asserts::Methods
|
18
|
-
#
|
19
|
-
|
20
|
-
# # Set assertion mode, see assert initializer
|
21
|
-
# config.assert_mode = :ignore
|
22
|
-
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basic_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Massimiliano Janes
|
@@ -88,6 +88,5 @@ rubyforge_project:
|
|
88
88
|
rubygems_version: 2.5.2
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
|
-
summary: A basic, customizable assertion
|
92
|
-
checking
|
91
|
+
summary: A basic, customizable assertion gem for lightweight pre-postconditions checking
|
93
92
|
test_files: []
|