bin/verify
#!/usr/bin/env ruby
# Require coverage reporter
require 'simplecov'
# Start coverage reporter
SimpleCov.start
# Capture stdout
$stdout = StringIO.new
# Enable test running
require 'test/unit'
# Set the name of the object type under test
object_type_under_test = ARGV[1] == 'inst' ? 'Instance' : 'Singleton'
# Set the name of the example under test
example_under_test = ARGV[0] == 'before' ? 'Before' : 'After'
# Display test information (when not reporting to codeclimate)
unless ENV.key? 'CC_TEST_REPORTER_ID'
# Define blue color code start and color termination
blue_code = "\e[36m"
color_end = "\e[0m"
# Test running message
test_msg = "Testing #{object_type_under_test}, #{example_under_test} Example"
# Text border
border = ('-' * 60) + "\n"
# Show message with test information
STDOUT.puts "#{border} #{blue_code} #{test_msg} #{color_end} \n#{border}"
end
# Require file under test from argument
require_relative "../exa/#{ARGV[0]}/#{ARGV[1]}.rb"
# Require tests for the example under test
require_relative "../tst/#{ARGV[1]}.rb"