From 19d768bd12231e96e82d21ac551865d447d04b8b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 19 Feb 2025 01:29:29 +0200 Subject: add chained --- lib/chained.rb | 7 +++++++ test/lib/dslkeywords/chain_test.rb | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 lib/chained.rb create mode 100644 test/lib/dslkeywords/chain_test.rb diff --git a/lib/chained.rb b/lib/chained.rb new file mode 100644 index 0000000..d775a6d --- /dev/null +++ b/lib/chained.rb @@ -0,0 +1,7 @@ +module RCM + # To allow chained barwords, e.g. "i want a beer" + module Chained + def method_missing(method_name, *args) = ([method_name] + args.flatten).join(' ') + def respond_to_missing? = true + end +end diff --git a/test/lib/dslkeywords/chain_test.rb b/test/lib/dslkeywords/chain_test.rb new file mode 100644 index 0000000..b996dcb --- /dev/null +++ b/test/lib/dslkeywords/chain_test.rb @@ -0,0 +1,14 @@ +require 'minitest/autorun' +require 'fileutils' + +require_relative '../../../lib/dsl' + +class RCMChainTest < Minitest::Test + def test_chain + configure_from_scratch do + notify hello dear world do + thank you to be part of you + end + end + end +end -- cgit v1.2.3