Sha256: d4b819cc57fae57a1e94008155a568152f0d408505b6da06434d5df529d41f19

Contents?: true

Size: 818 Bytes

Versions: 232

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

module ActiveSupport
  module Testing
    module Declarative
      unless defined?(Spec)
        # Helper to define a test method using a String. Under the hood, it replaces
        # spaces with underscores and defines the test method.
        #
        #   test "verify something" do
        #     ...
        #   end
        def test(name, &block)
          test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
          defined = method_defined? test_name
          raise "#{test_name} is already defined in #{self}" if defined
          if block_given?
            define_method(test_name, &block)
          else
            define_method(test_name) do
              flunk "No implementation provided for #{name}"
            end
          end
        end
      end
    end
  end
end

Version data entries

232 entries across 217 versions & 27 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/testing/declarative.rb
activesupport-8.0.1 lib/active_support/testing/declarative.rb
activesupport-8.0.0.1 lib/active_support/testing/declarative.rb
activesupport-7.2.2.1 lib/active_support/testing/declarative.rb
activesupport-7.1.5.1 lib/active_support/testing/declarative.rb
activesupport-7.0.8.7 lib/active_support/testing/declarative.rb
activesupport-8.0.0 lib/active_support/testing/declarative.rb
activesupport-7.2.2 lib/active_support/testing/declarative.rb
activesupport-7.1.5 lib/active_support/testing/declarative.rb
activesupport-8.0.0.rc2 lib/active_support/testing/declarative.rb
activesupport-7.2.1.2 lib/active_support/testing/declarative.rb
activesupport-7.1.4.2 lib/active_support/testing/declarative.rb
activesupport-7.0.8.6 lib/active_support/testing/declarative.rb
activesupport-6.1.7.10 lib/active_support/testing/declarative.rb
activesupport-8.0.0.rc1 lib/active_support/testing/declarative.rb
activesupport-6.1.7.9 lib/active_support/testing/declarative.rb
activesupport-7.2.1.1 lib/active_support/testing/declarative.rb
activesupport-7.1.4.1 lib/active_support/testing/declarative.rb
activesupport-7.0.8.5 lib/active_support/testing/declarative.rb
activesupport-8.0.0.beta1 lib/active_support/testing/declarative.rb