class Fitting::Tests

Public Class Methods

new(tested_requests) click to toggle source
# File lib/fitting/tests.rb, line 5
def initialize(tested_requests)
  @tested_requests = tested_requests
end

Public Instance Methods

make_dir(dir_name) click to toggle source
# File lib/fitting/tests.rb, line 19
def make_dir(dir_name)
  FileUtils.mkdir_p(dir_name)
end
save() click to toggle source
# File lib/fitting/tests.rb, line 9
def save
  make_dir('fitting_tests')
  array = @tested_requests.inject([]) do |res, request|
    res.push(request.to_spherical.to_hash)
  end
  json = JSON.dump(array)

  File.open("fitting_tests/test#{ENV["TEST_ENV_NUMBER"]}.json", 'w') { |file| file.write(json) }
end