Skip to content

Commit

Permalink
try TLDR for tests. works locally but sorbet / tapioca are being fussy
Browse files Browse the repository at this point in the history
$ be tldr
Command: bundle exec tldr --seed 8408 --prepend "test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb"

πŸƒ Running:

😁πŸ«₯😁😁πŸ«₯😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁πŸ«₯😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁πŸ«₯😁πŸ«₯😁😁πŸ«₯😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁πŸ«₯😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁πŸ«₯😁😁

Skipped tests:

  - MockingMethodfulClassesTest#test_overrides_nil? [test/safe/mocking_methodful_classes_test.rb:87]
  - OfNextTest#test_of_next_multiples_then_returns_to_normal [test/safe/of_next_test.rb:43]
  - OfNextTest#test_of_next_multiples_then_returns_to_replaced_version_when_runtime_is_disabled [test/safe/of_next_test.rb:78]
  - Mocktail::DeclaresDryClassTest#test_declares_dry_class_from_module [test/unit/imitates_type/makes_double/declares_dry_class_test.rb:56]
  - Mocktail::Matchers::BaseTest#test_default_method_stubs [test/unit/matchers/base_test.rb:8]
  - RegistersMatcherTest#test_blows_up_when_misnamed [test/unit/registers_matcher_test.rb:96]
  - RegistersMatcherTest#test_blows_up_when_bad_match? [test/unit/registers_matcher_test.rb:144]
  - RegistersMatcherTest#test_blows_up_when_not_a_class [test/unit/registers_matcher_test.rb:177]

Finished in 95ms.

1 test class, 133 test methods, 0 failures, 0 errors, 8 skips
  • Loading branch information
searls committed Sep 25, 2023
1 parent 1f50a01 commit a5b3604
Show file tree
Hide file tree
Showing 35 changed files with 91 additions and 164 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ source "https://rubygems.org"
gemspec

gem "rake"
gem "minitest"
gem "tldr", github: "tenderlove/tldr"
gem "standard"
gem "standard-sorbet"
gem "simplecov"
gem "m"

gem "sorbet-static"
gem "tapioca"
Expand Down
25 changes: 18 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: https://github.com/tenderlove/tldr.git
revision: 94b2835ba7e1ee10b80df6328ca599823608dfbe
specs:
tldr (0.1.0)
concurrent-ruby (~> 1.2)
super_diff (~> 0.10)

PATH
remote: .
specs:
Expand All @@ -9,23 +17,23 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
attr_extras (7.1.0)
base64 (0.1.1)
concurrent-ruby (1.2.2)
diff-lcs (1.5.0)
docile (1.4.0)
erubi (1.12.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
m (1.6.1)
method_source (>= 0.6.7)
rake (>= 0.9.2.2)
method_source (1.0.0)
minitest (5.19.0)
netrc (0.11.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)
prettier_print (1.2.1)
racc (1.7.1)
rainbow (3.1.1)
Expand Down Expand Up @@ -100,6 +108,10 @@ GEM
standard-sorbet (0.0.2)
lint_roller (~> 1.1)
rubocop-sorbet (~> 0.7.0)
super_diff (0.10.0)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
syntax_tree (6.1.1)
prettier_print (>= 1.2.0)
tapioca (0.11.8)
Expand All @@ -126,8 +138,6 @@ PLATFORMS
ruby

DEPENDENCIES
m
minitest
mocktail!
rake
rubocop-sorbet
Expand All @@ -137,6 +147,7 @@ DEPENDENCIES
standard
standard-sorbet
tapioca
tldr!

BUNDLED WITH
2.3.6
8 changes: 1 addition & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
require "bundler/gem_tasks"
require "rake/testtask"
require "standard/rake"

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

task default: [:test, "standard:fix"]
task default: ["standard:fix"]
9 changes: 6 additions & 3 deletions script/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

set -xeuo pipefail

echo "-----> Running Standard Ruby"
bundle exec rake standard:fix

echo "-----> Running Mocktail's test against src"
COVER=true bundle exec rake
COVER=true bundle exec tldr

echo "-----> Type-checking Mocktail source"
bundle exec srb tc
Expand All @@ -12,10 +15,10 @@ echo "-----> Building src/mocktail into lib/mocktail and lib/mocktail/sorbet"
./script/build

echo "-----> Running Mocktail's test against lib"
MOCKTAIL_TEST_SRC_DIRECTORY="lib" bundle exec rake
MOCKTAIL_TEST_SRC_DIRECTORY="lib" bundle exec tldr

echo "-----> Running Mocktail's test against lib/mocktail/sorbet"
MOCKTAIL_TEST_SRC_DIRECTORY="lib/mocktail/sorbet" bundle exec rake
MOCKTAIL_TEST_SRC_DIRECTORY="lib/mocktail/sorbet" bundle exec tldr

echo "-----> Ensuring that double-requiring Mocktail produces the right warning and bails out of redefining constants"
script/test_double_require_warnings
Expand Down
7 changes: 3 additions & 4 deletions test/test_helper.rb β†’ test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@

$LOAD_PATH.unshift File.expand_path("../#{ENV["MOCKTAIL_TEST_SRC_DIRECTORY"] || "src"}", __dir__)
require "mocktail"
require "minitest/autorun"

# T is not defined yet, so we can't use T.unsafe to pass typechecking
if eval("Mocktail::TYPED", binding, __FILE__, __LINE__)
require_relative "support/sorbet_override"
else
require_relative "support/sorbet_stubs"
end
require "tldr"

class Minitest::Test
class TLDR
extend T::Sig
include TLDR::Assertions::MinitestCompatibility

protected

make_my_diffs_pretty!

sig { params(blk: T.proc.void).returns(Thread) }
def thread(&blk)
Thread.new(&blk).tap do |t|
Expand Down
4 changes: 1 addition & 3 deletions test/mocktail_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class MocktailTest < Minitest::Test
class MocktailTest < TLDR
extend T::Sig

sig { void }
Expand Down
4 changes: 1 addition & 3 deletions test/safe/call_count_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class CallCountTest < Minitest::Test
class CallCountTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/dsl_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class DslTest < Minitest::Test
class DslTest < TLDR
extend T::Sig

sig { void }
Expand Down
8 changes: 3 additions & 5 deletions test/safe/explain_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class ExplainTest < Minitest::Test
class ExplainTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down Expand Up @@ -41,7 +39,7 @@ def test_explain_stub_returned_nil
The call site:
#{__FILE__}:25:in `test_explain_stub_returned_nil'
#{__FILE__}:23:in `test_explain_stub_returned_nil'
No stubbings were configured on this method.
Expand Down Expand Up @@ -75,7 +73,7 @@ def test_explain_stub_returned_nil_with_stubbings
The call site:
#{__FILE__}:56:in `test_explain_stub_returned_nil_with_stubbings'
#{__FILE__}:54:in `test_explain_stub_returned_nil_with_stubbings'
Stubbings configured prior to this call but not satisfied by it:
Expand Down
4 changes: 1 addition & 3 deletions test/safe/kwargs_vs_options_hash_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class KwargsVsOptionsHashTest < Minitest::Test
class KwargsVsOptionsHashTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/mocking_methodful_classes_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class MockingMethodfulClassesTest < Minitest::Test
class MockingMethodfulClassesTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/of_next_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class OfNextTest < Minitest::Test
class OfNextTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/of_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class OfTest < Minitest::Test
class OfTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/replace_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class ReplaceTest < Minitest::Test
class ReplaceTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
4 changes: 1 addition & 3 deletions test/safe/reset_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class ResetTest < Minitest::Test
class ResetTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down
6 changes: 2 additions & 4 deletions test/safe/stub_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class StubTest < Minitest::Test
class StubTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down Expand Up @@ -322,7 +320,7 @@ def test_param_checking
}, "Library paths should not appear in backtrace:\n#{e.backtrace.join("\n")}"

# Make sure the message contains the call
assert_equal "missing keyword: :and [Mocktail call: `do(1, 2, also: 3) { Proc at test/safe/stub_test.rb:318 }']", e.message
assert_equal "missing keyword: :and [Mocktail call: `do(1, 2, also: 3) { Proc at test/safe/stub_test.rb:316 }']", e.message

# Make sure it doesn't raise:
does_too_much.do(1, and: 2)
Expand Down
12 changes: 5 additions & 7 deletions test/safe/verify_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict

require "test_helper"

class VerifyTest < Minitest::Test
class VerifyTest < TLDR
include Mocktail::DSL
extend T::Sig

Expand Down Expand Up @@ -120,13 +118,13 @@ def test_blocks
assert_equal <<~MSG, e.message
Expected mocktail of `VerifyTest::Syn#ack' to be called like:
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:117 }
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:115 }
It was called differently 2 times:
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:109 }
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:107 }
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:110 }
ack(:apple, b: :banana) { Proc at test/safe/verify_test.rb:108 }
MSG
end
Expand Down Expand Up @@ -175,7 +173,7 @@ def test_verify_that_ignores_unspecified_blocks
It was called differently 1 time:
ack(42) { Proc at test/safe/verify_test.rb:164 }
ack(42) { Proc at test/safe/verify_test.rb:162 }
MSG
end
Expand Down
10 changes: 3 additions & 7 deletions test/unit/imitates_type/makes_double/declares_dry_class_test.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# typed: strict

require "test_helper"

module Mocktail
class DeclaresDryClassTest < Minitest::Test
class DeclaresDryClassTest < TLDR
include Mocktail::DSL
extend T::Sig

sig { params(name: String).void }
def initialize(name)
super

sig { void }
def initialize
@subject = T.let(DeclaresDryClass.new, DeclaresDryClass)
end

Expand Down
10 changes: 3 additions & 7 deletions test/unit/matcher_presentation_test.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# typed: strict

require "test_helper"

module Mocktail
class MatcherPresentationTest < Minitest::Test
class MatcherPresentationTest < TLDR
extend T::Sig

sig { params(name: String).void }
def initialize(name)
super

sig { void }
def initialize
@subject = T.let(MatcherPresentation.new, MatcherPresentation)
end

Expand Down
4 changes: 1 addition & 3 deletions test/unit/matchers/base_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# typed: strict

require "test_helper"

module Mocktail::Matchers
class BaseTest < Minitest::Test
class BaseTest < TLDR
extend T::Sig

sig { void }
Expand Down
4 changes: 1 addition & 3 deletions test/unit/matchers/captor_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# typed: true

require "test_helper"

module Mocktail::Matchers
class CaptorTest < Minitest::Test
class CaptorTest < TLDR
extend T::Sig

sig { void }
Expand Down
4 changes: 1 addition & 3 deletions test/unit/matchers/includes_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# typed: strict

require "test_helper"

module Mocktail::Matchers
class IncludesTest < Minitest::Test
class IncludesTest < TLDR
extend T::Sig

sig { void }
Expand Down
Loading

0 comments on commit a5b3604

Please sign in to comment.