Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to used ruby 2.7 #1719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
6 changes: 4 additions & 2 deletions lib/factory_bot/definition_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def transient(&block)
# end
#
# are equivalent.


def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
association_options = args.first

Expand Down Expand Up @@ -119,8 +121,8 @@ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondTo
# end
#
# Except that no globally available sequence will be defined.
def sequence(name, ...)
sequence = Sequence.new(name, ...)
def sequence(name, *args, &block)
sequence = Sequence.new(name, *args, &block)
FactoryBot::Internal.register_inline_sequence(sequence)
add_attribute(name) { increment_sequence(sequence) }
end
Expand Down
8 changes: 4 additions & 4 deletions lib/factory_bot/evaluator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def association(factory_name, *traits_and_overrides)

attr_accessor :instance

def method_missing(method_name, ...)
def method_missing(method_name, *args, &block) # Correção: adicionados *args e &block
if @instance.respond_to?(method_name)
@instance.send(method_name, ...)
@instance.send(method_name, *args, &block) # Correção: adicionados *args e &block
else
SyntaxRunner.new.send(method_name, ...)
SyntaxRunner.new.send(method_name, *args, &block) # Correção: adicionados *args e &block
end
end

Expand Down Expand Up @@ -77,4 +77,4 @@ def self.define_attribute(name, &block)
end
end
end
end
end
4 changes: 2 additions & 2 deletions lib/factory_bot/syntax/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def factory(name, options = {}, &block)
end
end

def sequence(name, ...)
Internal.register_sequence(Sequence.new(name, ...))
def sequence(name, *args, &block)
register_sequence(Sequence.new(name, *args, &block))
end

def trait(name, &block)
Expand Down