module RSpec::Support::WithKeywordsWhenNeeded

def class_exec(klass, *args, &block)

def class_exec(klass, *args, &block)
  if MethodSignature.new(block).has_kw_args_in?(args)
    binding.eval(<<-CODE, __FILE__, __LINE__)
    kwargs = args.pop
    klass.class_exec(*args, **kwargs, &block)
    CODE
  else
    klass.class_exec(*args, &block)
  end
end

def class_exec(klass, *args, &block)

def class_exec(klass, *args, &block)
  klass.class_exec(*args, &block)
end