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
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/testing/declarative.rb
activesupport-7.0.4.3 lib/active_support/testing/declarative.rb
activesupport-6.1.7.3 lib/active_support/testing/declarative.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/testing/declarative.rb
activesupport-6.1.7.2 lib/active_support/testing/declarative.rb
activesupport-7.0.4.2 lib/active_support/testing/declarative.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/testing/declarative.rb
activesupport-7.0.4.1 lib/active_support/testing/declarative.rb
activesupport-6.1.7.1 lib/active_support/testing/declarative.rb
activesupport-6.0.6.1 lib/active_support/testing/declarative.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/testing/declarative.rb
activesupport-7.0.4 lib/active_support/testing/declarative.rb
activesupport-6.1.7 lib/active_support/testing/declarative.rb
activesupport-6.0.6 lib/active_support/testing/declarative.rb
activesupport-7.0.3.1 lib/active_support/testing/declarative.rb
activesupport-6.1.6.1 lib/active_support/testing/declarative.rb
activesupport-6.0.5.1 lib/active_support/testing/declarative.rb
activesupport-5.2.8.1 lib/active_support/testing/declarative.rb
activesupport-5.2.8 lib/active_support/testing/declarative.rb
activesupport-6.0.5 lib/active_support/testing/declarative.rb