From a412c793263a2cafb8421c486ac855f7483c240e Mon Sep 17 00:00:00 2001 From: Kazuki Nishikawa Date: Sat, 8 Feb 2025 14:12:07 +0900 Subject: [PATCH] add spec ref: #331 --- .../method_definition.rb.spec | 10 ++++++++++ .../method_definition_with_receiver.rb.spec | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec b/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec index c0d995be..bdf487f8 100644 --- a/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec +++ b/spec/lib/rufo/formatter_source_specs/method_definition.rb.spec @@ -371,3 +371,13 @@ end def foo(a, ...) p(...) end + +#~# ORIGINAL issue_331 +def foo a: + a +end + +#~# EXPECTED +def foo(a:) + a +end diff --git a/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec b/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec index c497d363..48e4416c 100644 --- a/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec +++ b/spec/lib/rufo/formatter_source_specs/method_definition_with_receiver.rb.spec @@ -65,3 +65,18 @@ def a x;x end;def b y;y end;def c z;z end # comment def a(x); x end def b(y); y end def c(z); z end # comment + +#~# ORIGINAL issue_331 +#~# parens_in_def: :dynamic +class User + def self.by_uid uid: + joins(:authentications).where(authentications: { uid: }).first + end +end + +#~# EXPECTED +class User + def self.by_uid uid: + joins(:authentications).where(authentications: { uid: }).first + end +end