testaroni 0.0.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36109349f3905ce7fd909ba4667a586ec73f80ea1701c5eb8eaf5483073fbf7f
4
- data.tar.gz: e8df45009b01946556f1a34798546b66b47f66ef7eb8eefb15b9f5d0e2458c57
3
+ metadata.gz: e98257815aa4fe0e8dba3a6d09b620603b53d096361cade4f04c39a868b7f538
4
+ data.tar.gz: a401773f6fb9146cd976339e60d318bb7fb5dec3ec6fd102e4795c1f2c2cf760
5
5
  SHA512:
6
- metadata.gz: 55161e1f0d162123879c6cf04c39848e1044ced7917c9266cf02eec565710dafa0a8a82d45729808ce13b03c92dda0a44a3cfca15fdab2bea9f055f2075e1de5
7
- data.tar.gz: 3eb3b5664b15acdb64b1283831c873d7871eec776717eda62a7498c301e529a6c92b5ee145be49f00657d351d44904e5e031eec6ac06fa6b1566048a66cf03d5
6
+ metadata.gz: 88dbd46c61dd97065069cdfe979719b57d0e22582fec4b0b2616d27bb799590f13204b7f4abe2f975a5e37ff79141b9452c64b7d5337a2fddcaadd7c07d8cd61
7
+ data.tar.gz: 8d38bdb6cf1b355572deb27499e709874180dd5a867838dfb4610d698a59bf6aaf4623e32d23edf7f102971f0ca79057b5f36a0d0d7f060050b81e531105e5cd
data/bin/testaroni ADDED
@@ -0,0 +1,6 @@
1
+ if File.exist?("tests")
2
+ puts '🍕 Running tests'
3
+ Dir.glob("tests/**/*.rb").each do |file|
4
+ load(file)
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ class Testaroni
2
+ class AssertionError < StandardError; end
3
+ end
@@ -1,7 +1,6 @@
1
1
  # Responsible for handling questions after calling make_sure or other methods
2
2
  class Testaroni
3
3
  class Evaluation
4
- include Testaroni::Message
5
4
  attr_reader :original_value, :runner
6
5
  def initialize(runner, original_value)
7
6
  @runner = runner
@@ -9,19 +8,11 @@ class Testaroni
9
8
  end
10
9
 
11
10
  def equals(matching_value)
12
- if original_value == matching_value
13
- test_passed_message
14
- else
15
- test_failed_message
16
- end
11
+ raise Testaroni::AssertionError if original_value != matching_value
17
12
  end
18
13
 
19
14
  def is_not(matching_value)
20
- if original_value != matching_value
21
- test_passed_message
22
- else
23
- test_failed_message
24
- end
15
+ raise Testaroni::AssertionError if original_value == matching_value
25
16
  end
26
17
  end
27
18
  end
@@ -10,10 +10,22 @@ class Testaroni
10
10
  instance_eval(&test_block)
11
11
  end
12
12
 
13
+ # Use it as a way to add to description?
14
+ # def it(description_addition)
15
+ # @description_addition += " - #{description_addition}"
16
+ # end
17
+
13
18
  # Base level helpers
14
19
  def make_sure(value)
15
20
  # Returns an object with access to methods ( .equals .is_not )
16
21
  Testaroni::Evaluation.new(self, value)
17
22
  end
23
+
24
+ alias :ensure :make_sure
25
+ alias :assert :make_sure
26
+
27
+ def should
28
+ Testaroni::ShouldContext.new(self)
29
+ end
18
30
  end
19
31
  end
@@ -0,0 +1,12 @@
1
+ class Testaroni
2
+ class ShouldContext
3
+ attr_reader :runner
4
+ def initialize(runner)
5
+ @runner = runner
6
+ end
7
+
8
+ def have(file)
9
+ raise AssertionError if !File.exist?(file)
10
+ end
11
+ end
12
+ end
@@ -4,6 +4,10 @@ class Testaroni
4
4
  # Run this in an isolated context with helpers included
5
5
  test_runner = Testaroni::Runner.new(description, &block)
6
6
  test_runner.call
7
+ rescue => AssertionError
8
+ puts "❌ Test failed: #{test_runner.description}"
9
+ else
10
+ puts "✅ Test passed: #{test_runner.description}"
7
11
  end
8
12
  end
9
13
  end
data/lib/testaroni.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  require_relative "./testaroni/test"
2
- require_relative "./testaroni/message"
2
+ require_relative "./testaroni/errors"
3
3
  require_relative "./testaroni/evaluation"
4
+ require_relative "./testaroni/should_context"
4
5
  require_relative "./testaroni/runner"
5
6
  include Testaroni::Test
6
7
 
7
- class Testaroni; end
8
-
9
- 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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Indigo Tech Tutorials
@@ -11,14 +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
- - lib/testaroni/message.rb
21
23
  - lib/testaroni/runner.rb
24
+ - lib/testaroni/should_context.rb
22
25
  - lib/testaroni/test.rb
23
26
  homepage: https://rubygems.org/gems/testaroni
24
27
  licenses:
@@ -1,11 +0,0 @@
1
- class Testaroni
2
- module Message
3
- def test_passed_message
4
- puts "✅ Test passed: #{runner.description}"
5
- end
6
-
7
- def test_failed_message
8
- puts "❌ Test failed: #{runner.description}"
9
- end
10
- end
11
- end