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