Class: Fitting::Tests
- Inherits:
-
Object
- Object
- Fitting::Tests
- Defined in:
- lib/fitting/tests.rb
Instance Method Summary collapse
-
#initialize(tested_requests) ⇒ Tests
constructor
A new instance of Tests.
- #make_dir(dir_name) ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(tested_requests) ⇒ Tests
Returns a new instance of Tests.
5 6 7 |
# File 'lib/fitting/tests.rb', line 5 def initialize(tested_requests) @tested_requests = tested_requests end |
Instance Method Details
#make_dir(dir_name) ⇒ Object
19 20 21 |
# File 'lib/fitting/tests.rb', line 19 def make_dir(dir_name) FileUtils.mkdir_p(dir_name) end |
#save ⇒ Object
9 10 11 12 13 14 15 16 17 |
# 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 |