Module: SimplyTestable::TestCase::InstanceMethods
- Defined in:
- lib/simply_testable/test_case.rb
Instance Method Summary collapse
Instance Method Details
#method_missing_with_create_object(symb, *args, &block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/simply_testable/test_case.rb', line 30 def method_missing_with_create_object(symb,*args, &block) method = symb.to_s # if method =~ /^create_(.+)(\!?)$/ if method =~ /^create_([^!]+)(!?)$/ factory = if( $1 == 'object' ) # doesn't work for controllers yet. Need to consider # singular and plural as well as "tests" method. # Probably should just use the explicit factory # name in the controller tests. # self.class.name.sub(/Test$/,'').underscore model_name.underscore else $1 end bang = $2 = args. if bang.blank? record = Factory.build(factory,) record.attributes = # occassionally needed (study_subject_id) record.save record else Factory(factory,) end else # super(symb,*args, &block) method_missing_without_create_object(symb,*args, &block) end end |
#model_name ⇒ Object
24 25 26 27 28 |
# File 'lib/simply_testable/test_case.rb', line 24 def model_name # self.class.name.sub(/Test$/,'') # self.class.name.demodulize.sub(/Test$/,'') self.class.st_model_name end |