Sha256: 667b7b979735419a9058828ac21dca94cf50cbbca1101aa16396480b080f4acf

Contents?: true

Size: 620 Bytes

Versions: 9

Compression:

Stored size: 620 Bytes

Contents

require 'fitting/statistics/template'

module Fitting
  class Tests
    def initialize(tested_requests)
      @tested_requests = tested_requests
    end

    def save
      make_dir('fitting_tests')
      array = @tested_requests.inject([]) do |res, request|
        next res unless request.path.to_s.start_with?(Fitting.configuration.prefix)
        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

    def make_dir(dir_name)
      FileUtils.mkdir_p(dir_name)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fitting-2.13.1 lib/fitting/tests.rb
fitting-2.13.0 lib/fitting/tests.rb
fitting-2.12.1 lib/fitting/tests.rb
fitting-2.12.0 lib/fitting/tests.rb
fitting-2.11.0 lib/fitting/tests.rb
fitting-2.10.0 lib/fitting/tests.rb
fitting-2.9.1 lib/fitting/tests.rb
fitting-2.9.0 lib/fitting/tests.rb
fitting-2.8.1 lib/fitting/tests.rb