From 847fb1dd7e1786a6eb6523aa7523eb3f0b413b24 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 7 Jul 2020 17:42:01 -0700 Subject: [PATCH 1/2] lib/context: fix Ruby 2.7 warning This fixes the warning for: ``` /vendor/gems/ruby/2.7.0/gems/shoulda-context-2.0.0/lib/shoulda/context/context.rb:209: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call ``` --- lib/shoulda/context/context.rb | 2 ++ test/shoulda/should_test.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index c15b2ffc..c6c34c7f 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -208,6 +208,8 @@ def test_name_prefix def method_missing(method, *args, &blk) test_unit_class.send(method, *args, &blk) end + ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true) + end class DuplicateTestError < RuntimeError; end diff --git a/test/shoulda/should_test.rb b/test/shoulda/should_test.rb index e9e95989..96f18054 100644 --- a/test/shoulda/should_test.rb +++ b/test/shoulda/should_test.rb @@ -192,6 +192,18 @@ def test_should_raise_on_duplicate_naming end end + def self.this_is_missing(foo, k: 1) + end + + def test_should_pass_on_missing_method + context = Shoulda::Context::Context.new("context name", self.class) do; end + + assert_nothing_raised do + h = { k: 42 } + context.this_is_missing(h) + end + end + # Should statements def test_should_have_should_hashes_when_given_should_statements From 38e0300e2598f90a54e4f6547f941e6a2b711eb7 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Wed, 8 Jul 2020 10:42:19 -0700 Subject: [PATCH 2/2] Fix Hound CI improvements --- lib/shoulda/context/context.rb | 1 - test/shoulda/should_test.rb | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index c6c34c7f..a40b3025 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -209,7 +209,6 @@ def method_missing(method, *args, &blk) test_unit_class.send(method, *args, &blk) end ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true) - end class DuplicateTestError < RuntimeError; end diff --git a/test/shoulda/should_test.rb b/test/shoulda/should_test.rb index 96f18054..f5970e9e 100644 --- a/test/shoulda/should_test.rb +++ b/test/shoulda/should_test.rb @@ -192,14 +192,13 @@ def test_should_raise_on_duplicate_naming end end - def self.this_is_missing(foo, k: 1) - end + def self.this_is_missing(foo, bar: 1) end def test_should_pass_on_missing_method - context = Shoulda::Context::Context.new("context name", self.class) do; end + context = Shoulda::Context::Context.new("context name", self.class) {} assert_nothing_raised do - h = { k: 42 } + h = { bar: 42 } context.this_is_missing(h) end end