Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
ruby-version: ['3.1', '3.2']
ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0']

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"
gemspec

gem "rake"
gem "minitest"
gem "minitest", "~> 5.26" # 6.0+ requires Ruby >= 3.2, dropping support for Ruby 3.1
gem "standard"
gem "standard-sorbet"
gem "simplecov"
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GEM
method_source (>= 0.6.7)
rake (>= 0.9.2.2)
method_source (1.1.0)
minitest (5.25.5)
minitest (5.27.0)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.7.4)
Expand Down Expand Up @@ -108,7 +108,7 @@ GEM
thor (1.3.2)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-emoji (4.2.0)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
Expand All @@ -122,7 +122,7 @@ PLATFORMS
DEPENDENCIES
bigdecimal
m
minitest
minitest (~> 5.26)
mocktail!
rake
simplecov
Expand Down
7 changes: 4 additions & 3 deletions lib/mocktail/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ def self.guard_against_mocktail_accidentally_calling_mocks_if_debugging!
base_path = Pathname.new(__FILE__).dirname.to_s
backtrace_minus_this_and_whoever_called_this = e.backtrace&.[](2..)
internal_call_sites = backtrace_minus_this_and_whoever_called_this&.take_while { |call_site|
# the "in `block" is very confusing but necessary to include lines after
# the "in `block"/"in 'block" (Ruby 3.4+ uses a single quote instead of a
# backtick) is very confusing but necessary to include lines after
# a stubs { blah.foo }.with { … } call, since that's when most of the
# good stuff happens
call_site.start_with?(base_path) || call_site.include?("in `block")
}&.reject { |call_site| call_site.include?("in `block") } || []
call_site.start_with?(base_path) || call_site.match?(/in [`']block/)
}&.reject { |call_site| call_site.match?(/in [`']block/) } || []

approved_call_sites = [
/fulfills_stubbing.rb:(16|20)/,
Expand Down
7 changes: 4 additions & 3 deletions lib/mocktail/sorbet/mocktail/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def self.guard_against_mocktail_accidentally_calling_mocks_if_debugging!
base_path = Pathname.new(__FILE__).dirname.to_s
backtrace_minus_this_and_whoever_called_this = e.backtrace&.[](2..)
internal_call_sites = backtrace_minus_this_and_whoever_called_this&.take_while { |call_site|
# the "in `block" is very confusing but necessary to include lines after
# the "in `block"/"in 'block" (Ruby 3.4+ uses a single quote instead of a
# backtick) is very confusing but necessary to include lines after
# a stubs { blah.foo }.with { … } call, since that's when most of the
# good stuff happens
call_site.start_with?(base_path) || call_site.include?("in `block")
}&.reject { |call_site| call_site.include?("in `block") } || []
call_site.start_with?(base_path) || call_site.match?(/in [`']block/)
}&.reject { |call_site| call_site.match?(/in [`']block/) } || []

approved_call_sites = [
/fulfills_stubbing.rb:(16|20)/,
Expand Down
7 changes: 6 additions & 1 deletion script/test_double_require_warnings
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ require "open3"

def assert_warning(command:, warning:)
stdout, stderr, status = Open3.capture3(command)
if stderr != warning
# Ignore incidental Ruby/RubyGems/Bundler runtime warnings (e.g. from a
# Ruby version shipping a newer RubyGems than an older pinned Bundler
# expects) -- they always follow Ruby's "path:line: warning: message"
# format, unlike Mocktail's own warning below.
relevant_stderr = stderr.lines.reject { |line| line.match?(/\A\S+:\d+: warning: /) }.join
if relevant_stderr != warning
fail <<~MSG
Expected the correct error message on STDERR but it was wrong"

Expand Down
7 changes: 4 additions & 3 deletions src/mocktail/debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def self.guard_against_mocktail_accidentally_calling_mocks_if_debugging!
base_path = Pathname.new(__FILE__).dirname.to_s
backtrace_minus_this_and_whoever_called_this = e.backtrace&.[](2..)
internal_call_sites = backtrace_minus_this_and_whoever_called_this&.take_while { |call_site|
# the "in `block" is very confusing but necessary to include lines after
# the "in `block"/"in 'block" (Ruby 3.4+ uses a single quote instead of a
# backtick) is very confusing but necessary to include lines after
# a stubs { blah.foo }.with { … } call, since that's when most of the
# good stuff happens
call_site.start_with?(base_path) || call_site.include?("in `block")
}&.reject { |call_site| call_site.include?("in `block") } || []
call_site.start_with?(base_path) || call_site.match?(/in [`']block/)
}&.reject { |call_site| call_site.match?(/in [`']block/) } || []

approved_call_sites = [
/fulfills_stubbing.rb:(16|20)/,
Expand Down
2 changes: 1 addition & 1 deletion sub_projects/sorbet_user/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gem "mocktail", path: "../..", require: "mocktail/sorbet"

gem "standard"
gem "standard-sorbet"
gem "minitest"
gem "minitest", "~> 5.26" # 6.0+ requires Ruby >= 3.2, dropping support for Ruby 3.1
gem "rake"
gem "m"

Expand Down
7 changes: 4 additions & 3 deletions sub_projects/sorbet_user/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GEM
method_source (>= 0.6.7)
rake (>= 0.9.2.2)
method_source (1.1.0)
minitest (5.25.5)
minitest (5.27.0)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.7.4)
Expand Down Expand Up @@ -100,7 +100,7 @@ GEM
thor (1.3.2)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-emoji (4.2.0)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
Expand All @@ -109,10 +109,11 @@ GEM
PLATFORMS
arm64-darwin-22
arm64-darwin-24
arm64-darwin-25

DEPENDENCIES
m
minitest
minitest (~> 5.26)
mocktail!
rake
sorbet
Expand Down
Loading
Loading