Class: Dcmgr::Endpoints::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/dcmgr/endpoints/core_api_mock.rb

Class Method Summary collapse

Class Method Details

.loadfile(path, ext = 'json') ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/dcmgr/endpoints/core_api_mock.rb', line 14

def self.loadfile(path, ext='json')
  root_path = File.expand_path('../../')
  controller,action = path.split('/')
  file = action + '.' + ext
  dir_path = File.join(root_path,'fixtures','mock',controller)
  readfile = File.join(dir_path,file)
  data = ''
  open(readfile) {|f| data = f.read }
  data
end