Rename with method to avoid recursive splat and ambiguity

This commit is contained in:
Michael Miller 2022-07-11 20:24:51 -06:00
parent 011ca37b50
commit 4f46c98a86
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
6 changed files with 8 additions and 8 deletions

View file

@ -12,7 +12,7 @@ module Spectator
end
# Returns a new stub with constrained arguments.
def with(constraint : AbstractArguments)
def with_constraint(constraint : AbstractArguments)
self.class.new(method, @exception, constraint, location)
end

View file

@ -16,7 +16,7 @@ module Spectator
end
# Returns a new stub with constrained arguments.
def with(constraint : AbstractArguments)
def with_constraint(constraint : AbstractArguments)
self.class.new(method, @values, constraint, location)
end

View file

@ -9,7 +9,7 @@ module Spectator
end
# Returns a new stub with constrained arguments.
def with(constraint : AbstractArguments)
def with_constraint(constraint : AbstractArguments)
self.class.new(method, constraint, location)
end
end

View file

@ -11,7 +11,7 @@ module Spectator
end
# Returns a new stub with constrained arguments.
def with(constraint : AbstractArguments)
def with_constraint(constraint : AbstractArguments)
self.class.new(method, @proc, constraint, location)
end

View file

@ -4,12 +4,12 @@ module Spectator
# Mixin intended for `Stub` to return new, modified stubs.
module StubModifiers
# Returns a new stub of the same type with constrained arguments.
abstract def with(constraint : AbstractArguments)
abstract def with_constraint(constraint : AbstractArguments)
# :ditto:
def with(*args, **kwargs)
constraint = Arguments.new(args, kwargs)
self.with(constraint)
constraint = Arguments.new(args, kwargs).as(AbstractArguments)
self.with_constraint(constraint)
end
end
end

View file

@ -12,7 +12,7 @@ module Spectator
end
# Returns a new stub with constrained arguments.
def with(constraint : AbstractArguments)
def with_constraint(constraint : AbstractArguments)
self.class.new(method, @value, constraint, location)
end