testaroni 0.0.2 → 0.0.4
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/bin/testaroni +6 -0
- data/lib/testaroni/errors.rb +3 -0
- data/lib/testaroni/evaluation.rb +6 -14
- data/lib/testaroni/runner.rb +18 -8
- data/lib/testaroni/should_context.rb +12 -0
- data/lib/testaroni/test.rb +6 -3
- data/lib/testaroni.rb +3 -5
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e98257815aa4fe0e8dba3a6d09b620603b53d096361cade4f04c39a868b7f538
|
|
4
|
+
data.tar.gz: a401773f6fb9146cd976339e60d318bb7fb5dec3ec6fd102e4795c1f2c2cf760
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88dbd46c61dd97065069cdfe979719b57d0e22582fec4b0b2616d27bb799590f13204b7f4abe2f975a5e37ff79141b9452c64b7d5337a2fddcaadd7c07d8cd61
|
|
7
|
+
data.tar.gz: 8d38bdb6cf1b355572deb27499e709874180dd5a867838dfb4610d698a59bf6aaf4623e32d23edf7f102971f0ca79057b5f36a0d0d7f060050b81e531105e5cd
|
data/bin/testaroni
ADDED
data/lib/testaroni/evaluation.rb
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
+
# Responsible for handling questions after calling make_sure or other methods
|
|
1
2
|
class Testaroni
|
|
2
3
|
class Evaluation
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def initialize(original_value)
|
|
4
|
+
attr_reader :original_value, :runner
|
|
5
|
+
def initialize(runner, original_value)
|
|
6
|
+
@runner = runner
|
|
7
7
|
@original_value = original_value
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def equals(matching_value)
|
|
11
|
-
if original_value
|
|
12
|
-
puts "✅ Test passed"
|
|
13
|
-
else
|
|
14
|
-
puts "❌ Test failed"
|
|
15
|
-
end
|
|
11
|
+
raise Testaroni::AssertionError if original_value != matching_value
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
def is_not(matching_value)
|
|
19
|
-
if original_value
|
|
20
|
-
puts "✅ Test passed"
|
|
21
|
-
else
|
|
22
|
-
puts "❌ Test failed"
|
|
23
|
-
end
|
|
15
|
+
raise Testaroni::AssertionError if original_value == matching_value
|
|
24
16
|
end
|
|
25
17
|
end
|
|
26
18
|
end
|
data/lib/testaroni/runner.rb
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
class Testaroni
|
|
2
2
|
class Runner
|
|
3
|
-
attr_reader :test_block
|
|
4
|
-
def initialize(&test_block)
|
|
3
|
+
attr_reader :description, :test_block
|
|
4
|
+
def initialize(description, &test_block)
|
|
5
|
+
@description = description
|
|
5
6
|
@test_block = test_block
|
|
6
7
|
end
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
def call
|
|
9
10
|
instance_eval(&test_block)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
#
|
|
13
|
+
# Use it as a way to add to description?
|
|
14
|
+
# def it(description_addition)
|
|
15
|
+
# @description_addition += " - #{description_addition}"
|
|
16
|
+
# end
|
|
13
17
|
|
|
18
|
+
# Base level helpers
|
|
14
19
|
def make_sure(value)
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
# Returns an object with access to methods ( .equals .is_not )
|
|
21
|
+
Testaroni::Evaluation.new(self, value)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
alias :ensure :make_sure
|
|
25
|
+
alias :assert :make_sure
|
|
26
|
+
|
|
27
|
+
def should
|
|
28
|
+
Testaroni::ShouldContext.new(self)
|
|
19
29
|
end
|
|
20
30
|
end
|
|
21
31
|
end
|
data/lib/testaroni/test.rb
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
class Testaroni
|
|
2
2
|
module Test
|
|
3
3
|
def test(description, &block)
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
test_runner = Testaroni::Runner.new(&block)
|
|
4
|
+
# Run this in an isolated context with helpers included
|
|
5
|
+
test_runner = Testaroni::Runner.new(description, &block)
|
|
7
6
|
test_runner.call
|
|
7
|
+
rescue => AssertionError
|
|
8
|
+
puts "❌ Test failed: #{test_runner.description}"
|
|
9
|
+
else
|
|
10
|
+
puts "✅ Test passed: #{test_runner.description}"
|
|
8
11
|
end
|
|
9
12
|
end
|
|
10
13
|
end
|
data/lib/testaroni.rb
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
require_relative "./testaroni/test"
|
|
2
|
+
require_relative "./testaroni/errors"
|
|
2
3
|
require_relative "./testaroni/evaluation"
|
|
4
|
+
require_relative "./testaroni/should_context"
|
|
3
5
|
require_relative "./testaroni/runner"
|
|
4
|
-
|
|
5
6
|
include Testaroni::Test
|
|
6
7
|
|
|
7
|
-
class Testaroni
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
puts "🍕 Running tests now!"
|
|
8
|
+
class Testaroni; end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: testaroni
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Indigo Tech Tutorials
|
|
@@ -11,13 +11,17 @@ date: 1980-01-02 00:00:00.000000000 Z
|
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Write tests for your ruby code.
|
|
13
13
|
email: indigo@tech.tut
|
|
14
|
-
executables:
|
|
14
|
+
executables:
|
|
15
|
+
- testaroni
|
|
15
16
|
extensions: []
|
|
16
17
|
extra_rdoc_files: []
|
|
17
18
|
files:
|
|
19
|
+
- bin/testaroni
|
|
18
20
|
- lib/testaroni.rb
|
|
21
|
+
- lib/testaroni/errors.rb
|
|
19
22
|
- lib/testaroni/evaluation.rb
|
|
20
23
|
- lib/testaroni/runner.rb
|
|
24
|
+
- lib/testaroni/should_context.rb
|
|
21
25
|
- lib/testaroni/test.rb
|
|
22
26
|
homepage: https://rubygems.org/gems/testaroni
|
|
23
27
|
licenses:
|