spectr 0.0.10 → 0.0.11
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/examples/integer_spectr.rb +17 -0
- data/lib/spectr.rb +32 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02e3b66bf8cede72831d6dd731dba21eb9b52243
|
4
|
+
data.tar.gz: 54e8528d94f1c24248c47c099ed8decefff292f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85fb9fd0cfb761545a4ff1837725d738ae3c16a029f02a3a2a683a37f9d63c6d5ca680394bf962e3f61fa31ceeaf92d689b4dd88621b7b59ac1fc32b3d97a811
|
7
|
+
data.tar.gz: 0c0131e325eaf5e6d1c7f390d49cbabec0055776e922128e10e2983337ef707ba161f6bf90c8cb3fe4c358557ca68bc37171cb49195b859eab02ae73e55b062b
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative '../lib/spectr'
|
2
|
+
|
3
|
+
Spectr.new.test 'Test the builtin Integer class' do |test|
|
4
|
+
int = 1
|
5
|
+
|
6
|
+
test.assume('int inherits from Integer', true) do
|
7
|
+
int.is_a?(Integer)
|
8
|
+
end
|
9
|
+
|
10
|
+
test.assume('int is 1', 1) do
|
11
|
+
int
|
12
|
+
end
|
13
|
+
|
14
|
+
test.assume('addition works', 2) do
|
15
|
+
int + 1
|
16
|
+
end
|
17
|
+
end
|
data/lib/spectr.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
class Spectr
|
2
|
+
def test(description)
|
3
|
+
@description = description
|
4
|
+
puts "INFO: #{description}"
|
5
|
+
yield self
|
6
|
+
self
|
7
|
+
end
|
8
|
+
|
9
|
+
def assume(assumption, expected_result)
|
10
|
+
@assumption = assumption
|
11
|
+
@expected_result = expected_result
|
12
|
+
begin
|
13
|
+
@result = yield
|
14
|
+
rescue => e
|
15
|
+
@result = e
|
16
|
+
end
|
17
|
+
compare
|
18
|
+
exit 255 if @abort
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def compare
|
24
|
+
if @result.eql? @expected_result
|
25
|
+
puts " GREEN: #{@assumption}"
|
26
|
+
else
|
27
|
+
puts " RED: #{@assumption}"
|
28
|
+
puts " Expected #{@expected_result.inspect} but got #{@result.inspect}"
|
29
|
+
@abort = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas Hanft
|
@@ -19,6 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- bin/spectr
|
22
|
+
- examples/integer_spectr.rb
|
23
|
+
- lib/spectr.rb
|
22
24
|
homepage: https://github.com/ParadoXxGER/spectr
|
23
25
|
licenses:
|
24
26
|
- MIT
|