mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-13 06:43:20 -04:00
Add initial tests that run Jim's "checks"
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -12,5 +12,5 @@ jobs:
|
||||
with:
|
||||
ruby-version: "3.2.2"
|
||||
|
||||
- name: rake check
|
||||
run: rake check
|
||||
- name: run tests
|
||||
run: rake test
|
||||
9
rakelib/test.rake
Normal file
9
rakelib/test.rake
Normal file
@@ -0,0 +1,9 @@
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << "tests"
|
||||
t.test_files = FileList["tests/**/*_test.rb"]
|
||||
t.verbose = true
|
||||
end
|
||||
desc 'Run tests'
|
||||
|
||||
26
tests/check_test.rb
Normal file
26
tests/check_test.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
require_relative "test_helper"
|
||||
|
||||
class CheckTest < Minitest::Test
|
||||
def with_captured_stdout
|
||||
original_stdout = $stdout
|
||||
$stdout = StringIO.new
|
||||
yield
|
||||
$stdout.string
|
||||
ensure
|
||||
$stdout = original_stdout
|
||||
end
|
||||
|
||||
def test_check_asserts
|
||||
output = with_captured_stdout do
|
||||
Rake::Task['check:asserts'].invoke
|
||||
end
|
||||
assert_match(/OK/, output)
|
||||
end
|
||||
|
||||
def test_check_abouts
|
||||
output = with_captured_stdout do
|
||||
Rake::Task['check:abouts'].invoke
|
||||
end
|
||||
assert_match(/OK/, output)
|
||||
end
|
||||
end
|
||||
4
tests/test_helper.rb
Normal file
4
tests/test_helper.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
require "minitest/autorun"
|
||||
require "rake"
|
||||
|
||||
Rake.application.load_rakefile
|
||||
Reference in New Issue
Block a user