brass 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +1 -1
- data/.yardopts +7 -0
- data/HISTORY.rdoc +10 -0
- data/README.md +26 -25
- data/lib/brass.rb +1 -1
- metadata +8 -7
data/.ruby
CHANGED
data/.yardopts
ADDED
data/HISTORY.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= HISTORY
|
2
2
|
|
3
|
+
== 1.2.0 | 2012-01-26
|
4
|
+
|
5
|
+
The default error is `RuntimeError` rather than `StandardError` to
|
6
|
+
match Ruby's default exception when no arguments are passed to `raise`.
|
7
|
+
|
8
|
+
Changes:
|
9
|
+
|
10
|
+
* Change default error to RuntimeError.
|
11
|
+
|
12
|
+
|
3
13
|
== 1.1.0 | 2012-01-25
|
4
14
|
|
5
15
|
Quick fix for issue with parsing arguments of #assert and #refute methods.
|
data/README.md
CHANGED
@@ -14,17 +14,17 @@ a framework's framework's framework, depending on where you're staking
|
|
14
14
|
out your assertions keister.
|
15
15
|
|
16
16
|
In other words, BRASS provides a standard rudimentary assertions framework
|
17
|
-
that all other assertion and
|
18
|
-
with, and then everyone gets on
|
17
|
+
that all other assertion and test frameworks can use, or at least comply
|
18
|
+
with, and then everyone gets on swimingly.
|
19
19
|
|
20
20
|
Now, you may be thinking, "No thanks, I do it my way." But when you see
|
21
21
|
how stupid simple BRASS is, you'll realize that, "Yea, that actually
|
22
|
-
make sense." And feel a bit
|
23
|
-
|
22
|
+
make sense." And then maybe feel a bit stupid yourself for doing exactly
|
23
|
+
what this paragrah just said you would do. Yea, well, we've all been there.
|
24
24
|
|
25
|
-
|
25
|
+
But enough with the fluff.
|
26
26
|
|
27
|
-
BRASS defines two Kernel methods: `assert` and `refute
|
27
|
+
BRASS defines two Kernel methods: `assert` and `refute`:
|
28
28
|
|
29
29
|
assert(truthiness, *fail_arguments)
|
30
30
|
refute(truthiness, *fail_arguments)
|
@@ -33,38 +33,39 @@ Where `truthiness` is any object evaluated for it's truth value (`false` and `ni
|
|
33
33
|
are `false`, everything else is `true`), and `fail_arguments` are exactly the same
|
34
34
|
as those we would pass to the `fail` or `raise` methods.
|
35
35
|
|
36
|
-
The `assert` and `refute`
|
37
|
-
then
|
38
|
-
|
39
|
-
by the `fail_arguments`.
|
36
|
+
The `assert` (and likewise `refute`) method does three things. First it tests the
|
37
|
+
`truthiness`, then it ticks up the appropriate counts in the global assertions
|
38
|
+
counter, and lastly, if truthiness came up short, it raises an error. This error
|
39
|
+
is either `RuntimeError` or the one specified by the `fail_arguments`.
|
40
40
|
|
41
|
-
The global assertions counter is `$ASSERTION_COUNTS`.
|
41
|
+
The global assertions counter is `$ASSERTION_COUNTS`. It is simply a Hash formally
|
42
42
|
defined as:
|
43
43
|
|
44
44
|
$ASSERTIONS_COUNTS = Hash.new{|h,k| h[k] = 0}
|
45
45
|
|
46
|
-
And though it is open to any key,
|
47
|
-
and standard `:pass`, `:fail` and `:total`. Whenever an assertion
|
48
|
-
the `:
|
49
|
-
fails the `:
|
46
|
+
And though it is open to any key, the keys should be symbols. Three keys in
|
47
|
+
particular and standard: `:pass`, `:fail` and `:total`. Whenever an assertion
|
48
|
+
passes, the `:pass` and `:total` counts are incremented, and whenever an assertion
|
49
|
+
fails the `:fail` and `:total` counts are incremented. You might wonder why
|
50
50
|
there is a total entry when the sum of the other two would do just as well.
|
51
|
-
Well, other frameworks might want to add
|
52
|
-
|
53
|
-
|
51
|
+
Well, other frameworks might want to add other counts, such as `:skip`. So
|
52
|
+
to ensure we still get the proper total despite this, we keep a separate tally.
|
53
|
+
Moving on....
|
54
54
|
|
55
55
|
Okay, last thing. When `assert` or `refute` raises an error, it marks the error
|
56
|
-
as an assertion via the
|
57
|
-
to the Exception class along with the
|
58
|
-
test framework can use to distinguish an assertion error from an ordinarily
|
56
|
+
as an assertion via the `#set_assertion` method. This is a method extension
|
57
|
+
to the Exception class along with the `#assertion?` method which any
|
58
|
+
test framework can use to distinguish an assertion error from an ordinarily
|
59
|
+
error.
|
59
60
|
|
60
|
-
|
61
|
+
And that's all there is to it. If you *capice* then consider yourself top brass.
|
61
62
|
|
63
|
+
Love, Peace and Brass Knuckles
|
62
64
|
|
63
|
-
## COPYING
|
64
65
|
|
65
|
-
|
66
|
+
## COPYING
|
66
67
|
|
67
|
-
All rights reserved.
|
68
|
+
Copyright (c) 2010 Rubyworks. All rights reserved.
|
68
69
|
|
69
70
|
Distribute in accordance with the **BSD-2-Clause** license.
|
70
71
|
|
data/lib/brass.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: detroit
|
16
|
-
requirement: &
|
16
|
+
requirement: &16988520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16988520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: lemon
|
27
|
-
requirement: &
|
27
|
+
requirement: &16987480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *16987480
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rubytest
|
38
|
-
requirement: &
|
38
|
+
requirement: &16986520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *16986520
|
47
47
|
description: ! 'BRASS stands for Bare-Metal Ruby Assertion System Standard. It is
|
48
48
|
a very basic
|
49
49
|
|
@@ -60,6 +60,7 @@ extra_rdoc_files:
|
|
60
60
|
- README.md
|
61
61
|
files:
|
62
62
|
- .ruby
|
63
|
+
- .yardopts
|
63
64
|
- lib/brass/expect.rb
|
64
65
|
- lib/brass.rb
|
65
66
|
- test/case_brass.rb
|