Method: StandardAPI::TestCase::ClassMethods#model
- Defined in:
- lib/standard_api/test_case.rb
#model ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/standard_api/test_case.rb', line 204 def model return @model if defined?(@model) && @model klass_name = controller_class.name.gsub(/Controller$/, '').singularize begin @model = klass_name.constantize rescue NameError raise e unless e. =~ /uninitialized constant #{klass_name}/ end if @model.nil? raise "@model is nil: make sure you set it in your test using `self.model = ModelClass`." else @model end end |