brass 1.2.0 → 1.3.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1aff0f1fb1eef83ed9e88118c9ad9905d7307bd4e4734f33cbc8f2e9b62db58
4
+ data.tar.gz: 9c66d0e7c03cb039a01d0db8a754266fafce40ac2cdf9c66f28d742bcd4c2ccb
5
+ SHA512:
6
+ metadata.gz: 39e3b53191b8ca07d46d2bc550ab3a763a18c420079b2e3223119c2ae1896712bbe9f6fe3f06f99720bcfc34c397caffeb0a64b778839da61a5d463121c77ff7
7
+ data.tar.gz: 59e8313763da62429de70baeb3c9f8ed984587bbd78c808f40bce7b3c587aa1938233e12ebbf766921da5e9c0822666ec0e7356e590de587dd9a7bbddb879719
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ (BSD-2-Clause License)
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
16
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
17
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
20
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,26 +1,34 @@
1
1
  # BRASS
2
2
 
3
- [Website](http://rubyworks.github.com/brass) /
4
- [Report Issue](http://github.com/rubyworks/brass/issues) /
5
- [Development](http://github.com/rubyworks/brass)
3
+ [Website](https://rubyworks.github.io/brass) |
4
+ [Report Issue](https://github.com/rubyworks/brass/issues) |
5
+ [Development](https://github.com/rubyworks/brass)
6
6
 
7
- [![Build Status](https://secure.travis-ci.org/rubyworks/brass.png)](http://travis-ci.org/rubyworks/brass)
7
+ <b>BRASS is a standard assertions framework, framework's framework, or even
8
+ a framework's framework's framework, depending on where you are staking
9
+ out your assertions keister. In other words, BRASS provides a foundational
10
+ assertions framework which all other assertion and test frameworks
11
+ can use, or at least comply with, and then everyone gets on swimmingly.</b>
8
12
 
9
13
 
10
- # DESCRIPTION
14
+ ## Status
11
15
 
12
- BRASS is a standard assertions framework, framework's framework, or even
13
- a framework's framework's framework, depending on where you're staking
14
- out your assertions keister.
16
+ [![Gem Version](https://img.shields.io/gem/v/brass.svg?style=flat)](https://rubygems.org/gems/brass)
17
+ [![Build Status](https://github.com/rubyworks/brass/actions/workflows/test.yml/badge.svg)](https://github.com/rubyworks/brass/actions/workflows/test.yml)
18
+ [![Report Issue](https://img.shields.io/github/issues/rubyworks/brass.svg?style=flat)](https://github.com/rubyworks/brass/issues)
15
19
 
16
- In other words, BRASS provides a standard rudimentary assertions framework
17
- that all other assertion and test frameworks can use, or at least comply
18
- with, and then everyone gets on swimingly.
20
+
21
+ ## Overview
22
+
23
+ BRASS is a very basic assertions framework. It is designed to provide only
24
+ the barest essentials for making assertions such that other assertion and
25
+ test frameworks can use it, or at least comply with it, making all said
26
+ frameworks interoperable.
19
27
 
20
28
  Now, you may be thinking, "No thanks, I do it my way." But when you see
21
29
  how stupid simple BRASS is, you'll realize that, "Yea, that actually
22
30
  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.
31
+ what this paragraph just said you would do. Yea, well, we've all been there.
24
32
 
25
33
  But enough with the fluff.
26
34
 
@@ -41,7 +49,7 @@ is either `RuntimeError` or the one specified by the `fail_arguments`.
41
49
  The global assertions counter is `$ASSERTION_COUNTS`. It is simply a Hash formally
42
50
  defined as:
43
51
 
44
- $ASSERTIONS_COUNTS = Hash.new{|h,k| h[k] = 0}
52
+ $ASSERTION_COUNTS = Hash.new{|h,k| h[k] = 0}
45
53
 
46
54
  And though it is open to any key, the keys should be symbols. Three keys in
47
55
  particular and standard: `:pass`, `:fail` and `:total`. Whenever an assertion
@@ -58,15 +66,22 @@ to the Exception class along with the `#assertion?` method which any
58
66
  test framework can use to distinguish an assertion error from an ordinarily
59
67
  error.
60
68
 
61
- And that's all there is to it. If you *capice* then consider yourself top brass.
69
+ And that's all there is to it. If you *capisce* then consider yourself top brass.
62
70
 
63
71
  Love, Peace and Brass Knuckles
64
72
 
65
73
 
66
- ## COPYING
74
+ ## Contributing
75
+
76
+ This project is so basic it is unlikely anything will even change. But you
77
+ never can tell! so if your have a brilliant idea, jump right in. Source
78
+ code management is handled by ye ol'Github at https://github.com/rubyworks/brass.
79
+
80
+
81
+ ## Copyrights
67
82
 
68
83
  Copyright (c) 2010 Rubyworks. All rights reserved.
69
84
 
70
85
  Distribute in accordance with the **BSD-2-Clause** license.
71
86
 
72
- See COPYING.md file for details.
87
+ See LICENSE.txt file for details.
data/VERSIONS.md ADDED
@@ -0,0 +1,59 @@
1
+ # HISTORY
2
+
3
+ ## 1.3.0 | 2026-03-30
4
+
5
+ Maintenance release. Modernized project tooling and cleaned up documentation.
6
+
7
+ Changes:
8
+
9
+ * Replace custom Indexer system with standard gemspec.
10
+ * Replace Travis CI with GitHub Actions.
11
+ * Replace Assembly/detroit with Rakefile.
12
+ * Fix typos in README and source code.
13
+ * Update URLs to HTTPS.
14
+ * Remove obsolete files (etc/, work/, MANIFEST).
15
+ * Clean up .gitignore.
16
+
17
+
18
+ ## 1.2.1 | 2012-02-09
19
+
20
+ This release adds framework adapters for MiniTest and TestUnit, which allows
21
+ those frameworks to recognize BRASS assertions as "failures" rather than
22
+ as "errors".
23
+
24
+ Changes:
25
+
26
+ * Add framework adapters for MiniTest and TestUnit.
27
+
28
+
29
+ ## 1.2.0 | 2012-01-26
30
+
31
+ The default error is `RuntimeError` rather than `StandardError` to
32
+ match Ruby's default exception when no arguments are passed to `raise`.
33
+
34
+ Changes:
35
+
36
+ * Change default error to RuntimeError.
37
+
38
+
39
+ ## 1.1.0 | 2012-01-25
40
+
41
+ Quick fix for issue with parsing arguments of #assert and #refute methods.
42
+ Also added #fail! method to dry-up code.
43
+
44
+ Changes:
45
+
46
+ * Fix arguments parsing for assert/refute.
47
+ * Add #fail! method to dry-up code.
48
+
49
+
50
+ ## 1.0.0 | 2012-01-24
51
+
52
+ This is the initial release of BRASS. It is given a 1.0.0 version
53
+ despite being such a new project because it is very simple and
54
+ the code is derived from other system that have used it for some time.
55
+
56
+ Changes:
57
+
58
+ * Happy Birthday!
59
+
@@ -0,0 +1,23 @@
1
+ module Minitest #:nodoc:
2
+ class Test #:nodoc:
3
+ # Override capture_exceptions to recognize BRASS assertion errors
4
+ # as test failures rather than errors.
5
+ alias_method :capture_exceptions_without_brass, :capture_exceptions
6
+
7
+ def capture_exceptions
8
+ yield
9
+ rescue *PASSTHROUGH_EXCEPTIONS
10
+ raise
11
+ rescue Assertion => e
12
+ self.failures << e
13
+ rescue Exception => e
14
+ if e.respond_to?(:assertion?) && e.assertion?
15
+ failure = Assertion.new(e.message)
16
+ failure.set_backtrace(e.backtrace)
17
+ self.failures << failure
18
+ else
19
+ self.failures << UnexpectedError.new(sanitize_exception(e))
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,36 @@
1
+ module Test #:nodoc:
2
+ module Unit #:nodoc:
3
+
4
+ module BrassAssertionHandler
5
+ class << self
6
+ def included(base)
7
+ base.exception_handler(:handle_brass_assertion_failed_error)
8
+ end
9
+ end
10
+
11
+ private
12
+ def handle_brass_assertion_failed_error(exception)
13
+ return false unless exception.assertion?
14
+ problem_occurred
15
+ #parameters = exception.parameters # TODO: assertion parameters
16
+ add_brass_failure exception.message, exception.backtrace,
17
+ #:expected => exception.expected,
18
+ #:actual => exception.actual,
19
+ #:inspected_expected => exception.inspected_expected,
20
+ #:inspected_actual => exception.inspected_actual,
21
+ :user_message => exception.message #exception.user_message
22
+ true
23
+ end
24
+
25
+ def add_brass_failure(message, backtrace, options={})
26
+ failure = Failure.new(name, filter_backtrace(backtrace), message, options)
27
+ current_result.add_failure(failure)
28
+ end
29
+ end
30
+
31
+ class TestCase #:nodoc:
32
+ include BrassAssertionHandler
33
+ end
34
+ end
35
+ end
36
+
data/lib/brass/expect.rb CHANGED
@@ -16,7 +16,7 @@ module Kernel
16
16
  rescue error_class
17
17
  assert(true)
18
18
  rescue Exception => err
19
- assert(false, error_class, "#{error_class} expected but #{err} was thrown")
19
+ assert(false, error_class, "#{error_class} expected but #{err.class} was thrown")
20
20
  end
21
21
  end
22
22
 
data/lib/brass.rb CHANGED
@@ -1,21 +1,55 @@
1
1
  class Exception
2
2
 
3
- # Is the exception an assertion error?
3
+ # Is the exception an assertion?
4
4
  def assertion?
5
5
  @assertion
6
6
  end
7
7
 
8
8
  # Set the the exception's assertion flag.
9
9
  def set_assertion(boolean)
10
- @assertion = boolean # ? true : false
10
+ @assertion = boolean # ? true : false
11
11
  end
12
12
 
13
13
  # Set message.
14
14
  # (not strictly needed here, but can be useful anyway).
15
+ #
16
+ # @todo Does the message have to be a string?
15
17
  def set_message(msg)
16
18
  @mesg = msg.to_str
17
19
  end
18
20
 
21
+ # Set priority level.
22
+ #
23
+ # @param [Integer] level
24
+ # The priority level of the exception.
25
+ #
26
+ def set_priority(level)
27
+ @priority = level.to_i
28
+ end
29
+
30
+ # Exceptions can have priority levels.
31
+ #
32
+ # Zero is a nominal error, the higher the priority the more severe the
33
+ # error is considered. Errors with priorities less than zero are taken
34
+ # be warnings, the lower the number the more trivial.
35
+ #
36
+ def priority
37
+ @priority ||= 0
38
+ end
39
+
40
+ # TODO: Consider assertion parameters for future version. If message
41
+ # does not have to be string, it might serve this purpose instead.
42
+ ##
43
+ #def parameters
44
+ # @parameters
45
+ #end
46
+ #
47
+ ## Set exception parameters. These are used to store specific information
48
+ ## relevant to a particular exception or assertion. Unlike the message,
49
+ ## which is a String, this is a Hash.
50
+ #def set_parameters(parameters)
51
+ # @parameters = parameters.to_hash
52
+ #end
19
53
  end
20
54
 
21
55
  module Kernel
@@ -78,7 +112,7 @@ module Kernel
78
112
  error_class = raise_arguments.shift
79
113
  error_class.new(*raise_arguments)
80
114
  else
81
- error_class = RuntimeError
115
+ error_class = $! || RuntimeError
82
116
  error_class.new(*raise_arguments)
83
117
  end
84
118
 
metadata CHANGED
@@ -1,95 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Thomas Sawyer
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2012-01-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
13
11
  dependencies:
14
12
  - !ruby/object:Gem::Dependency
15
- name: detroit
16
- requirement: &16988520 !ruby/object:Gem::Requirement
17
- none: false
13
+ name: rake
14
+ requirement: !ruby/object:Gem::Requirement
18
15
  requirements:
19
- - - ! '>='
16
+ - - ">="
20
17
  - !ruby/object:Gem::Version
21
- version: '0'
18
+ version: '13'
22
19
  type: :development
23
20
  prerelease: false
24
- version_requirements: *16988520
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '13'
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: lemon
27
- requirement: &16987480 !ruby/object:Gem::Requirement
28
- none: false
28
+ requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ! '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: '0.9'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *16987480
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0.9'
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: rubytest
38
- requirement: &16986520 !ruby/object:Gem::Requirement
39
- none: false
42
+ requirement: !ruby/object:Gem::Requirement
40
43
  requirements:
41
- - - ! '>='
44
+ - - ">="
42
45
  - !ruby/object:Gem::Version
43
- version: '0'
46
+ version: '0.8'
44
47
  type: :development
45
48
  prerelease: false
46
- version_requirements: *16986520
47
- description: ! 'BRASS stands for Bare-Metal Ruby Assertion System Standard. It is
48
- a very basic
49
-
50
- foundational assertions framework for other assertion and test frameworks
51
-
52
- to make use so they can all work together harmoniously.'
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0.8'
54
+ description: BRASS stands for Bare-Metal Ruby Assertion System Standard. It is a very
55
+ basic foundational assertions framework for other assertion and test frameworks
56
+ to make use so they can all work together harmoniously.
53
57
  email:
54
58
  - transfire@gmail.com
55
59
  executables: []
56
60
  extensions: []
57
- extra_rdoc_files:
58
- - HISTORY.rdoc
59
- - COPYING.rdoc
60
- - README.md
61
+ extra_rdoc_files: []
61
62
  files:
62
- - .ruby
63
- - .yardopts
64
- - lib/brass/expect.rb
65
- - lib/brass.rb
66
- - test/case_brass.rb
67
- - HISTORY.rdoc
63
+ - LICENSE.txt
68
64
  - README.md
69
- - COPYING.rdoc
70
- homepage: http://rubyworks.github.com/brass
65
+ - VERSIONS.md
66
+ - lib/brass.rb
67
+ - lib/brass/adapters/minitest.rb
68
+ - lib/brass/adapters/testunit.rb
69
+ - lib/brass/expect.rb
70
+ homepage: https://github.com/rubyworks/brass
71
71
  licenses:
72
72
  - BSD-2-Clause
73
- post_install_message:
73
+ metadata: {}
74
74
  rdoc_options: []
75
75
  require_paths:
76
76
  - lib
77
77
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
78
  requirements:
80
- - - ! '>='
79
+ - - ">="
81
80
  - !ruby/object:Gem::Version
82
- version: '0'
81
+ version: '3.1'
83
82
  required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
83
  requirements:
86
- - - ! '>='
84
+ - - ">="
87
85
  - !ruby/object:Gem::Version
88
86
  version: '0'
89
87
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 1.8.10
92
- signing_key:
93
- specification_version: 3
94
- summary: Bare-Metal Ruby Assertion System Standard
88
+ rubygems_version: 3.6.9
89
+ specification_version: 4
90
+ summary: Bare-metal Ruby Assertion System Standard
95
91
  test_files: []
data/.ruby DELETED
@@ -1,53 +0,0 @@
1
- ---
2
- source:
3
- - meta
4
- authors:
5
- - name: Thomas Sawyer
6
- email: transfire@gmail.com
7
- copyrights:
8
- - holder: Rubyworks
9
- year: '2012'
10
- license: BSD-2-Clause
11
- replacements: []
12
- alternatives: []
13
- requirements:
14
- - name: detroit
15
- groups:
16
- - build
17
- development: true
18
- - name: lemon
19
- groups:
20
- - test
21
- development: true
22
- - name: rubytest
23
- groups:
24
- - test
25
- development: true
26
- dependencies: []
27
- conflicts: []
28
- repositories:
29
- - uri: git@github.com:rubyworks/brass.git
30
- scm: git
31
- name: upstream
32
- resources:
33
- home: http://rubyworks.github.com/brass
34
- docs: http://rubydoc.info/gems/brass
35
- code: http://github.com/rubyworks/brass
36
- mail: http://groups.google.com/groups/rubyworks-mailinglist
37
- extra: {}
38
- load_path:
39
- - lib
40
- revision: 0
41
- created: '2012-01-24'
42
- summary: Bare-Metal Ruby Assertion System Standard
43
- title: BRASS
44
- version: 1.2.0
45
- name: brass
46
- description: ! 'BRASS stands for Bare-Metal Ruby Assertion System Standard. It is
47
- a very basic
48
-
49
- foundational assertions framework for other assertion and test frameworks
50
-
51
- to make use so they can all work together harmoniously.'
52
- organization: Rubyworks
53
- date: '2012-01-25'
data/.yardopts DELETED
@@ -1,7 +0,0 @@
1
- --title "BRASS"
2
- --readme README.md
3
- --protected
4
- --private
5
- lib
6
- -
7
- [A-Z]*.*
data/COPYING.rdoc DELETED
@@ -1,38 +0,0 @@
1
- = COPYRIGHT
2
-
3
- == NOTICES
4
-
5
- === Brass
6
-
7
- Copyright:: (c) 2012 RubyWorks
8
- License:: (r) BSD-2-Clause
9
- Website:: http://rubyworks.github.com/brass
10
-
11
- == LICENSES
12
-
13
- === BSD-2-Clause License
14
-
15
- Brass
16
-
17
- Copyright (c) 2012 Rubyworks. All rights reserved.
18
-
19
- Redistribution and use in source and binary forms, with or without
20
- modification, are permitted provided that the following conditions are met:
21
-
22
- 1. Redistributions of source code must retain the above copyright notice,
23
- this list of conditions and the following disclaimer.
24
-
25
- 2. Redistributions in binary form must reproduce the above copyright
26
- notice, this list of conditions and the following disclaimer in the
27
- documentation and/or other materials provided with the distribution.
28
-
29
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
30
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
34
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
36
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/HISTORY.rdoc DELETED
@@ -1,33 +0,0 @@
1
- = HISTORY
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
-
13
- == 1.1.0 | 2012-01-25
14
-
15
- Quick fix for issue with parsing arguments of #assert and #refute methods.
16
- Also added #fail! method to dry-up code.
17
-
18
- Changes:
19
-
20
- * Fix arguments parsing for assert/refute.
21
- * Add #fail! method to dry-up code.
22
-
23
-
24
- == 1.0.0 | 2012-01-24
25
-
26
- This is the initial release of BRASS. It is given a 1.0.0 version
27
- despite being such a new project because it is very simple and
28
- the code is derived from other system that have used it for some time.
29
-
30
- Changes:
31
-
32
- * Happy Birthday!
33
-
data/test/case_brass.rb DELETED
@@ -1,22 +0,0 @@
1
- covers 'brass'
2
-
3
- testcase Kernel do
4
-
5
- method :assert do
6
-
7
- test do
8
- assert(true)
9
- end
10
-
11
- end
12
-
13
- method :refute do
14
-
15
- test do
16
- refute(false)
17
- end
18
-
19
- end
20
-
21
- end
22
-