Sha256: 02f6642a5312b3ccffeff585e191c8a244a8f3f21dbab940540db75208a45c4e

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require_relative "./simplecov_init"
require 'minitest/autorun'

if RUBY_PLATFORM=='java'
  require 'rhino'
else
  require 'v8'
end

# allows import of patient api without rails
module HqueryPatientApi 
  module Rails
    class Engine

    end
  end
end


PROJECT_ROOT = File.expand_path("../../", __FILE__)
require File.join(PROJECT_ROOT, 'lib', 'hqmf2js')

def get_js_context(javascript)
  if RUBY_PLATFORM=='java'
    @context = Rhino::Context.new
  else
    @context = V8::Context.new
  end
  @context.eval(javascript)
  @context
end

def initialize_javascript_context(hqmf_utils, codes_json, converted_hqmf)
  fixture_json = File.read('test/fixtures/patients/larry_vanderman.json')
  initialize_patient = 'var numeratorPatient = new hQuery.Patient(larry);'

  if RUBY_PLATFORM=='java'
    @context = Rhino::Context.new
  else
    @context = V8::Context.new
  end
  @context.eval("
    #{hqmf_utils}
    var OidDictionary = #{codes_json};
    #{converted_hqmf}
    var larry = #{fixture_json};
    #{initialize_patient}")
  @context.eval("hqmf.SpecificsManager.initialize()")
end

def compile_coffee_script
  ctx = Sprockets::Environment.new(File.expand_path("../../..", __FILE__))
  Tilt::CoffeeScriptTemplate.default_bare = true 
  ctx.append_path "app/assets/javascripts"
  HQMF2JS::Generator::JS.library_functions
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hqmf2js-1.4.0 test/test_helper.rb