Sha256: 8ed60fb697eefa4987ece19b286b5ffce098e711446ead27ff2b8624d7e85d8f
Contents?: true
Size: 1.33 KB
Versions: 21
Compression:
Stored size: 1.33 KB
Contents
require 'active_support/concern' require 'test/unit/assertions' module RSpec module Rails module SetupAndTeardownAdapter extend ActiveSupport::Concern module ClassMethods def setup(*methods) methods.each {|method| before { send method } } end def teardown(*methods) methods.each {|method| after { send method } } end end module InstanceMethods def method_name @example end end end module TestUnitAssertionAdapter extend ActiveSupport::Concern class AssertionDelegate include Test::Unit::Assertions end module ClassMethods def assertion_method_names Test::Unit::Assertions.public_instance_methods.select{|m| m.to_s =~ /^(assert|flunk)/} + [:build_message] end def define_assertion_delegators assertion_method_names.each do |m| class_eval <<-CODE def #{m}(*args, &block) assertion_delegate.send :#{m}, *args, &block end CODE end end end module InstanceMethods def assertion_delegate @assertion_delegate ||= AssertionDelegate.new end end included do define_assertion_delegators end end end end
Version data entries
21 entries across 21 versions & 1 rubygems