testaroni 0.0.2 → 0.0.3

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: 28d681b309900cdf3d1c96f24e9fa540a4d8668d224330466c5603e05015fc71
4
- data.tar.gz: 05be8d4e6dc955be5c27bc9761e8392ebc8fdbc068fee164fc380b008fb2a7ba
3
+ metadata.gz: 36109349f3905ce7fd909ba4667a586ec73f80ea1701c5eb8eaf5483073fbf7f
4
+ data.tar.gz: e8df45009b01946556f1a34798546b66b47f66ef7eb8eefb15b9f5d0e2458c57
5
5
  SHA512:
6
- metadata.gz: 6e2b62090725c1865c9ef6edbc9daeb9c0f6bae12dc38c871474c8bf18a1d446ea45d2a889f66888b7142b21114541cb3914f7836cc24dd631ecd3afd9e67e7d
7
- data.tar.gz: 183643da6c40d63ac3a8466e56092cbe9a10ad2dc2170299b59a761584b978d6813d55c4f296f474ce8a791049c0f343de2a8b4cb4e54068240e0e05dfbbfb55
6
+ metadata.gz: 55161e1f0d162123879c6cf04c39848e1044ced7917c9266cf02eec565710dafa0a8a82d45729808ce13b03c92dda0a44a3cfca15fdab2bea9f055f2075e1de5
7
+ data.tar.gz: 3eb3b5664b15acdb64b1283831c873d7871eec776717eda62a7498c301e529a6c92b5ee145be49f00657d351d44904e5e031eec6ac06fa6b1566048a66cf03d5
@@ -1,25 +1,26 @@
1
+ # Responsible for handling questions after calling make_sure or other methods
1
2
  class Testaroni
2
3
  class Evaluation
3
- # Responsible for handling questions after calling
4
- # make_sure or other methods
5
- attr_reader :original_value
6
- def initialize(original_value)
4
+ include Testaroni::Message
5
+ attr_reader :original_value, :runner
6
+ def initialize(runner, original_value)
7
+ @runner = runner
7
8
  @original_value = original_value
8
9
  end
9
10
 
10
11
  def equals(matching_value)
11
12
  if original_value == matching_value
12
- puts "✅ Test passed"
13
+ test_passed_message
13
14
  else
14
- puts "❌ Test failed"
15
+ test_failed_message
15
16
  end
16
17
  end
17
18
 
18
19
  def is_not(matching_value)
19
20
  if original_value != matching_value
20
- puts "✅ Test passed"
21
+ test_passed_message
21
22
  else
22
- puts "❌ Test failed"
23
+ test_failed_message
23
24
  end
24
25
  end
25
26
  end
@@ -0,0 +1,11 @@
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
@@ -1,21 +1,19 @@
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
  # Base level helpers
13
-
14
14
  def make_sure(value)
15
- # Need to ensure something happens
16
- # Returns an object with access to methods
17
- # .equals .is_not
18
- Testaroni::Evaluation.new(value)
15
+ # Returns an object with access to methods ( .equals .is_not )
16
+ Testaroni::Evaluation.new(self, value)
19
17
  end
20
18
  end
21
19
  end
@@ -1,9 +1,8 @@
1
1
  class Testaroni
2
2
  module Test
3
3
  def test(description, &block)
4
- # need to define test helper methods
5
- # Run this in an isolated context with helpers included?
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
8
7
  end
9
8
  end
data/lib/testaroni.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  require_relative "./testaroni/test"
2
+ require_relative "./testaroni/message"
2
3
  require_relative "./testaroni/evaluation"
3
4
  require_relative "./testaroni/runner"
4
-
5
5
  include Testaroni::Test
6
6
 
7
- class Testaroni
8
- end
7
+ class Testaroni; end
9
8
 
10
9
  puts "🍕 Running tests now!"
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Indigo Tech Tutorials
@@ -17,6 +17,7 @@ extra_rdoc_files: []
17
17
  files:
18
18
  - lib/testaroni.rb
19
19
  - lib/testaroni/evaluation.rb
20
+ - lib/testaroni/message.rb
20
21
  - lib/testaroni/runner.rb
21
22
  - lib/testaroni/test.rb
22
23
  homepage: https://rubygems.org/gems/testaroni