Skip to content
Open
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.0', '3.1', '3.2']
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']

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

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

require "test_helper"
require "support/version_helper"

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

class Thing
extend T::Sig
Expand Down Expand Up @@ -41,7 +43,7 @@ def test_explain_stub_returned_nil

The call site:

#{__FILE__}:25:in `test_explain_stub_returned_nil'
#{__FILE__}:27:in #{at_least_ruby_3_4? ? "'ExplainTest#" : "`"}test_explain_stub_returned_nil'

No stubbings were configured on this method.

Expand Down Expand Up @@ -75,7 +77,7 @@ def test_explain_stub_returned_nil_with_stubbings

The call site:

#{__FILE__}:56:in `test_explain_stub_returned_nil_with_stubbings'
#{__FILE__}:58:in #{at_least_ruby_3_4? ? "'ExplainTest#" : "`"}test_explain_stub_returned_nil_with_stubbings'

Stubbings configured prior to this call but not satisfied by it:

Expand Down
11 changes: 11 additions & 0 deletions test/support/version_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# typed: false

module VersionHelper
def ruby_version
Gem::Version.new(RUBY_VERSION)
end

def at_least_ruby_3_4?
ruby_version >= "3.4"
end
end
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# typed: strict

require "test_helper"
require "support/version_helper"

module Mocktail
class StringifiesCallTest < Minitest::Test
extend T::Sig
include VersionHelper

sig { params(name: String).void }
def initialize(name)
Expand Down Expand Up @@ -33,21 +35,32 @@ def test_some_calls
assert_equal "hi([], [1], [[2]], [[3, 4], [5, 6]])", invoke(args: [
[], [1], [[2]], [[3, 4], [5, 6]]
])
assert_equal "hi({}, {:a=>1}, {:b=>2, :c=>3}, {:d=>[4, {:e=>5}]})", invoke(args: [
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
])

if at_least_ruby_3_4?
assert_equal "hi({}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]})", invoke(args: [
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
])
else
assert_equal "hi({}, {:a=>1}, {:b=>2, :c=>3}, {:d=>[4, {:e=>5}]})", invoke(args: [
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
])
end

# Kwargs
assert_equal "hi(a: 1)", invoke(kwargs: {a: 1})
assert_equal "hi(c: 2, b: 3)", invoke(kwargs: {c: 2, b: 3})
assert_equal "hi(d: {:e=>4}, f: [:g, {:h=>5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
if at_least_ruby_3_4?
assert_equal "hi(d: {e: 4}, f: [:g, {h: 5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
else
assert_equal "hi(d: {:e=>4}, f: [:g, {:h=>5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
end

# Blocks & Procs
assert_equal "hi { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:46 }", invoke {}
assert_equal "hi(&lambda[test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:47])", invoke(&lambda {})
assert_equal "hi { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:59 }", invoke {}
assert_equal "hi(&lambda[test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:60])", invoke(&lambda {})

# Mix & Match
assert_equal "hi(:a, 1, b: 2) { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:50 }", invoke(args: [:a, 1], kwargs: {b: 2}) { |c| 3 }
assert_equal "hi(:a, 1, b: 2) { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:63 }", invoke(args: [:a, 1], kwargs: {b: 2}) { |c| 3 }
end

private
Expand Down
Loading