Module: SimplyTestable::Declarative::ClassMethods

Defined in:
lib/simply_testable/declarative.rb

Instance Method Summary collapse

Instance Method Details

#test_with_verbosity(name, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/simply_testable/declarative.rb', line 14

def test_with_verbosity(name,&block)
	test_without_verbosity(name,&block)

	test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
	define_method("_#{test_name}_with_verbosity") do
		print "\n#{self.class.name.gsub(/Test$/,'').titleize} #{name}: "
		send("_#{test_name}_without_verbosity")
	end
	#
	#	can't do this.  
	#		alias_method_chain test_name, :verbosity
	#	end up with 2 methods that begin
	#	with 'test_' so they both get run
	#
	alias_method "_#{test_name}_without_verbosity".to_sym,
		test_name
	alias_method test_name,
		"_#{test_name}_with_verbosity".to_sym
end