Skip to content

Commit

Permalink
move from minitest to tldr
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Sep 28, 2023
1 parent c172ced commit f280bb5
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ source "https://rubygems.org"
gemspec

gem "rake"
gem "minitest"
gem "tldr"
gem "gimme"
gem "standard"
18 changes: 15 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,29 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
attr_extras (7.1.0)
backports (3.24.1)
bar-of-progress (0.1.3)
base64 (0.1.1)
concurrent-ruby (1.2.2)
diff-lcs (1.5.0)
gimme (0.5.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
minitest (5.20.0)
optimist (3.1.0)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
patience_diff (1.2.0)
optimist (~> 3.0)
racc (1.7.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.6)
rubocop (1.56.3)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -59,6 +64,13 @@ GEM
standard-performance (1.2.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.19.0)
super_diff (0.10.0)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
tldr (0.5.0)
concurrent-ruby (~> 1.2)
super_diff (~> 0.10)
unicode-display_width (2.4.2)

PLATFORMS
Expand All @@ -67,10 +79,10 @@ PLATFORMS

DEPENDENCIES
gimme
minitest
rake
standard
suture!
tldr

BUNDLED WITH
2.4.19
31 changes: 9 additions & 22 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
require "bundler/gem_tasks"
require "rake/testtask"
require "tldr/rake"

Rake::TestTask.new(:unit) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/helper.rb", "test/**/*_test.rb"]
end
TLDR::Task.new(:name => :unit)
TLDR::Task.new(:name => :safe, :config => TLDR::Config.new(
:parallel => false,
:load_paths => ["safe", "lib"],
:helper => "safe/helper.rb",
:paths => FileList["safe/**/*_test.rb"]
))

Rake::TestTask.new(:safe) do |t|
t.libs << "safe"
t.libs << "lib"
t.test_files = FileList["safe/helper.rb", "safe/**/*_test.rb"]
end

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "safe"
t.libs << "lib"
t.test_files = FileList[
"test/helper.rb",
"test/**/*_test.rb",
"safe/helper.rb",
"safe/**/*_test.rb"
]
end
task :test => [:unit, :safe]

require "standard/rake"
task :default => [:test, :"standard:fix"]
4 changes: 2 additions & 2 deletions safe/helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require "minitest/autorun"
require "tldr"
require "suture"

require "fileutils"
class SafeTest < Minitest::Test
class SafeTest < TLDR
def setup
super
clean("db")
Expand Down
5 changes: 3 additions & 2 deletions test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require "minitest/autorun"
require "gimme"
require "tldr"

require "suture/config"
require "support/assertions"
class UnitTest < Minitest::Test
class UnitTest < TLDR
include Support::Assertions
include TLDR::Assertions::MinitestCompatibility

def setup
super
Expand Down
8 changes: 4 additions & 4 deletions test/support/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Assertions
##
# Fails if +matcher+ <tt>=~</tt> +obj+.

def assert_not_match matcher, obj, msg = nil
msg = message(msg) { "Expected #{mu_pp matcher} NOT to match #{mu_pp obj} (but it totally did)" }
def assert_not_match matcher, obj
msg = proc { "Expected #{mu_pp matcher} NOT to match #{mu_pp obj} (but it totally did)" }
assert_respond_to matcher, :=~
matcher = Regexp.new Regexp.escape matcher if String === matcher
assert !(matcher =~ obj), msg
Expand All @@ -14,9 +14,9 @@ def assert_not_match matcher, obj, msg = nil
# Fails unless +matcher+ <tt>=~</tt> +obj+ (with whitespace normalized a bit)
# Flips expected & actual so it's easier to use heredocs

def assert_spacey_match obj, matcher, msg = nil
def assert_spacey_match obj, matcher
og_matcher = matcher
msg = message(msg) {
msg = proc {
<<-MSG.gsub(/^ {10}/, "")
Expected this #{obj.class}:
```
Expand Down
2 changes: 2 additions & 0 deletions test/suture/adapter/log_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Suture::Adapter
class LogTest < UnitTest
dont_run_these_in_parallel!

class FakeThing
include Suture::Adapter::Log

Expand Down

0 comments on commit f280bb5

Please sign in to comment.