forked from spatten/ruby_koans
-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial tests that run Jim's "checks"
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,5 @@ jobs: | |
with: | ||
ruby-version: "3.2.2" | ||
|
||
- name: rake check | ||
run: rake check | ||
- name: run tests | ||
run: rake test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require "minitest/autorun" | ||
require "rake" | ||
|
||
Rake.application.load_rakefile |