Sha256: d4b819cc57fae57a1e94008155a568152f0d408505b6da06434d5df529d41f19

Contents?: true

Size: 818 Bytes

Versions: 233

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

233 entries across 218 versions & 28 rubygems

Version Path
nullifyable-0.1.0 vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/declarative.rb
activesupport-5.2.2 lib/active_support/testing/declarative.rb
activesupport-5.2.2.rc1 lib/active_support/testing/declarative.rb
activesupport-5.2.1.1 lib/active_support/testing/declarative.rb
activesupport-5.2.1 lib/active_support/testing/declarative.rb
activesupport-5.2.1.rc1 lib/active_support/testing/declarative.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/activesupport-5.2.0/lib/active_support/testing/declarative.rb
activesupport-5.2.0 lib/active_support/testing/declarative.rb
activesupport-5.2.0.rc2 lib/active_support/testing/declarative.rb
activesupport-5.2.0.rc1 lib/active_support/testing/declarative.rb
activesupport-5.2.0.beta2 lib/active_support/testing/declarative.rb
activesupport-5.2.0.beta1 lib/active_support/testing/declarative.rb
ruby-on-quails-0.1.0 activesupport/lib/active_support/testing/declarative.rb