diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4df57da88..523c77859 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,5 +12,5 @@ jobs: with: ruby-version: "3.2.2" - - name: rake check - run: rake check \ No newline at end of file + - name: run tests + run: rake test \ No newline at end of file diff --git a/rakelib/test.rake b/rakelib/test.rake new file mode 100644 index 000000000..952ce7f84 --- /dev/null +++ b/rakelib/test.rake @@ -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' + diff --git a/tests/check_test.rb b/tests/check_test.rb new file mode 100644 index 000000000..ba51df26d --- /dev/null +++ b/tests/check_test.rb @@ -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 \ No newline at end of file diff --git a/tests/test_helper.rb b/tests/test_helper.rb new file mode 100644 index 000000000..0abf0b640 --- /dev/null +++ b/tests/test_helper.rb @@ -0,0 +1,4 @@ +require "minitest/autorun" +require "rake" + +Rake.application.load_rakefile \ No newline at end of file