Class: DefaultTestCase0

Inherits:
BaseTestCase show all
Defined in:
app/models/default_test_case.rb

Overview

DefaultTests4

Direct Known Subclasses

DefaultTestCase1

Instance Method Summary collapse

Instance Method Details

#data_source_directory?(model_name = model_name?) ) ⇒ Boolean

global_class_names

Returns:

  • (Boolean)

223
224
225
# File 'app/models/default_test_case.rb', line 223

def data_source_directory?(model_name=model_name?)
	'test/data_sources/'+model_name.to_s+'/'
end

#global_class_namesObject

names_of_tests


220
221
222
# File 'app/models/default_test_case.rb', line 220

def global_class_names
	Module.constants.select {|n| eval(n.to_s).instance_of?(Class)}
end

#model_class?Boolean

model_name?

Returns:

  • (Boolean)

205
206
207
208
209
210
211
# File 'app/models/default_test_case.rb', line 205

def model_class?
	begin
		eval(model_name?.to_s)
	rescue
		nil
	end #begin rescue
end

#model_name?Boolean

Extract model name from test name if Rails-like naming convention is followed

Returns:

  • (Boolean)

202
203
204
# File 'app/models/default_test_case.rb', line 202

def model_name?
	name_of_test?.sub(/Test$/, '').sub(/Assertions$/, '').to_sym
end

#name_of_test?Boolean

doesn't follow any class filenaming conventions

Returns:

  • (Boolean)

198
199
200
# File 'app/models/default_test_case.rb', line 198

def name_of_test?
	self.class.name
end

#names_of_tests?Boolean

table_name?

Returns:

  • (Boolean)

215
216
217
218
219
# File 'app/models/default_test_case.rb', line 215

def names_of_tests?
	self.methods(true).select do |m|
		m.match(/^test(_class)?_assert_(invariant|pre_conditions|post_conditions)/) 
	end #map
end

#table_name?Boolean

model_class?

Returns:

  • (Boolean)

212
213
214
# File 'app/models/default_test_case.rb', line 212

def table_name?
	model_name?.to_s.tableize
end