blackstart 0.2.0 → 0.8.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.
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
4
+ version: 0.8.0
11
5
  platform: ruby
12
6
  authors:
13
7
  - Aaron Beckerman
@@ -15,7 +9,7 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2024-05-14 00:00:00 -07:00
12
+ date: 2026-06-04 00:00:00 -07:00
19
13
  default_executable:
20
14
  dependencies: []
21
15
 
@@ -28,39 +22,29 @@ extensions: []
28
22
  extra_rdoc_files: []
29
23
 
30
24
  files:
31
- - LICENSE.txt
32
- - README.txt
33
- - blackstart.gemspec
25
+ - LICENSE
26
+ - README
34
27
  - lib/blackstart.rb
28
+ - sig/blackstart.rbs
35
29
  - test/blackstart_test.rb
36
30
  has_rdoc: true
37
31
  homepage:
38
32
  licenses:
39
- - MIT
33
+ - Apache-2.0
40
34
  post_install_message:
41
35
  rdoc_options: []
42
36
 
43
37
  require_paths:
44
38
  - lib
45
39
  required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
40
  requirements:
48
41
  - - ">="
49
42
  - !ruby/object:Gem::Version
50
- hash: 57
51
- segments:
52
- - 1
53
- - 8
54
- - 7
55
43
  version: 1.8.7
56
44
  required_rubygems_version: !ruby/object:Gem::Requirement
57
- none: false
58
45
  requirements:
59
46
  - - ">="
60
47
  - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
48
  version: "0"
65
49
  requirements: []
66
50
 
@@ -69,5 +53,5 @@ rubygems_version: 1.6.2
69
53
  signing_key:
70
54
  specification_version: 3
71
55
  summary: A small, subdued library for automated testing.
72
- test_files:
73
- - test/blackstart_test.rb
56
+ test_files: []
57
+
data/LICENSE.txt DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2024 Aaron Beckerman
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
- of the Software, and to permit persons to whom the Software is furnished to do
8
- so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
data/README.txt DELETED
@@ -1,152 +0,0 @@
1
- Blackstart
2
-
3
- Blackstart is a small, subdued library for automated testing in Ruby. It
4
- doesn't depend on anything beyond the Ruby platform and doesn't modify the
5
- environment outside its conventional namespace. It's tested with a primitive
6
- program, not via another automated-testing library.
7
-
8
- The blackstart is a small, subdued bird that eats bugs. A black start is when a
9
- power plant starts up without relying on the electrical grid.
10
-
11
- Here's an example of a test program that uses Blackstart:
12
-
13
- require "blackstart"
14
-
15
- exit Blackstart.run Blackstart.add { |adder|
16
- adder.call do
17
- unless "Hello, World!" == ["He", "", "o, Wor", "d!"].join("l")
18
- raise "join did not work as expected"
19
- end
20
- end
21
-
22
- adder.call do
23
- unless "sample" == "simple".gsub(/i/, "a")
24
- raise "gsub did not work as expected"
25
- end
26
- end
27
- }
28
-
29
- Blackstart.add adds procs to a collection and returns that collection. In the
30
- example, each proc is designed to run a test and, if it fails, raise an error
31
- to signal this.
32
-
33
- Blackstart.run runs a sequence of tests and reports information about any that
34
- fail -- that is, any that raise an error. In the example, failure information
35
- would be written to the standard output stream. It returns false if there were
36
- failures; otherwise, it returns true.
37
-
38
- The library provides little beyond this, but it's easy to do relatively
39
- sophisticated things with it. Some examples follow.
40
-
41
-
42
- - Exiting with the appropriate status
43
-
44
- Blackstart.run returns false if there were any failures; otherwise, it returns
45
- true. If you use this as the argument to Kernel#exit, your test program will
46
- exit with a successful status only if there were no failures.
47
-
48
-
49
- - Defining helpers
50
-
51
- You may want all your tests to be able to assert something, generate test data,
52
- or perform some other task by sending a message. You could implement this
53
- statelessly in a singleton object or all instances of Object, for example, but
54
- there's another option that may be more convenient. Blackstart.run calls each
55
- test proc in the context of a new Blackstart::Context instance. You can define
56
- instance methods in that class like this:
57
-
58
- class Blackstart::Context
59
- def assert boolean
60
- raise "assertion failed" unless boolean
61
- end
62
-
63
- def make_products
64
- @cabbage = { :description => "head of cabbage", :price => 125 }
65
- @orange = { :description => "Cara cara navel orange", :price => 100 }
66
- nil
67
- end
68
- end
69
-
70
- All of your tests will be able to use them by sending messages to self. These
71
- methods can see and modify the test's state, which is disposable: it will be
72
- discarded after the test is complete and so will not affect later tests.
73
-
74
-
75
- - Running code before and after each test
76
-
77
- You can run code before and after each test by defining a custom
78
- Blackstart::Context#instance_exec. For example:
79
-
80
- class Blackstart::Context
81
- def instance_exec(*)
82
- puts "before test"
83
- @variable = "example"
84
- super
85
- ensure
86
- puts "after test"
87
- end
88
- end
89
-
90
-
91
- - Building a test collection in stages
92
-
93
- You can build your collection of test objects in stages and run it at the end.
94
- For example:
95
-
96
- require "blackstart"
97
-
98
- TEST_OBJECTS = []
99
-
100
- Blackstart.add TEST_OBJECTS do |adder|
101
- adder.call do
102
- unless "Hello, World!" == ["He", "", "o, Wor", "d!"].join("l")
103
- raise "join did not work as expected"
104
- end
105
- end
106
- end
107
-
108
- Blackstart.add TEST_OBJECTS do |adder|
109
- adder.call do
110
- unless "sample" == "simple".gsub(/i/, "a")
111
- raise "gsub did not work as expected"
112
- end
113
- end
114
- end
115
-
116
- exit Blackstart.run TEST_OBJECTS
117
-
118
- This makes it straightforward to define your tests in multiple files that you
119
- load in your test program.
120
-
121
-
122
- - Running tests in random order
123
-
124
- Blackstart.run runs a sequence of tests in order, but you can pass it a
125
- randomly-ordered sequence. Array#shuffle may be helpful for this. If you do
126
- this, you may also want to print the random seed at the start of your program
127
- so you can re-run your tests in the same order.
128
-
129
-
130
- - Reporting detailed test descriptions
131
-
132
- After a test fails, Blackstart.run writes a description of the test to the
133
- output stream. It gets this description by converting the test object to a
134
- string. When the test object is an instance of Proc, which is what
135
- Blackstart.add normally produces, this string typically includes the file path
136
- and line number where it was defined: helpful, but it won't be immediately
137
- clear what was being tested.
138
-
139
- You can improve this by making your own test objects instead of using
140
- Blackstart.add. Blackstart.run does not strictly need a sequence of Proc
141
- instances; it only needs a sequence of objects that convert to Proc instances
142
- in response to to_proc messages. Your custom test objects can respond to to_s
143
- with detailed descriptions instead of mere file paths and line numbers.
144
-
145
-
146
- - Handling failures differently
147
-
148
- Blackstart.run handles each failure by sending a puts message to the output
149
- stream, one of its parameters. By default, this is $stdout, so the default
150
- behavior is to print unadorned failure information to standard output. But you
151
- can specify any object as the output stream -- even if it's not really a stream
152
- -- allowing you to handle failure information however you want.
data/blackstart.gemspec DELETED
@@ -1,11 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "blackstart"
3
- s.version = "0.2.0"
4
- s.authors = ["Aaron Beckerman"]
5
- s.summary = "A small, subdued library for automated testing."
6
- s.licenses = ["MIT"]
7
- s.required_ruby_version = ">= 1.8.7"
8
- s.files = ["LICENSE.txt", "README.txt", "blackstart.gemspec",
9
- "lib/blackstart.rb", "test/blackstart_test.rb"]
10
- s.test_files = ["test/blackstart_test.rb"]
11
- end