From 4196492242c88cadd6b07fc4c3ac15c5ae2c3e95 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Tue, 19 Nov 2024 08:20:40 -0500 Subject: [PATCH] update template for runnable helper --- lib/inferno/apps/cli/templates/Gemfile.tt | 4 ++++ .../spec/%library_name%/patient_group_spec.rb.tt | 13 +------------ .../apps/cli/templates/spec/spec_helper.rb.tt | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/inferno/apps/cli/templates/Gemfile.tt b/lib/inferno/apps/cli/templates/Gemfile.tt index 382378ec4..65d5b3a1d 100644 --- a/lib/inferno/apps/cli/templates/Gemfile.tt +++ b/lib/inferno/apps/cli/templates/Gemfile.tt @@ -7,3 +7,7 @@ gemspec group :development, :test do gem 'debug' end + +group :test do + gem 'rack-test' +end \ No newline at end of file diff --git a/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt b/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt index 58c462d7c..262a8050f 100644 --- a/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt +++ b/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt @@ -1,8 +1,6 @@ RSpec.describe <%= module_name %>::PatientGroup do - let(:suite) { Inferno::Repositories::TestSuites.new.find('<%= test_suite_id %>') } + let(:suite_id) { '<%= test_suite_id %>' } let(:group) { suite.groups[1] } - let(:session_data_repo) { Inferno::Repositories::SessionData.new } - let(:test_session) { repo_create(:test_session, test_suite_id: '<%= test_suite_id %>') } let(:url) { 'http://example.com/fhir' } let(:success_outcome) do { @@ -25,15 +23,6 @@ RSpec.describe <%= module_name %>::PatientGroup do } end - def run(runnable, inputs = {}) - test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash) - test_run = Inferno::Repositories::TestRuns.new.create(test_run_params) - inputs.each do |name, value| - session_data_repo.save(test_session_id: test_session.id, name: name, value: value, type: 'text') - end - Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable) - end - describe 'read test' do let(:test) { group.tests.first } let(:patient_id) { 'abc123' } diff --git a/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt b/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt index f30b83fca..5ef8a0b9e 100644 --- a/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt +++ b/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt @@ -127,7 +127,7 @@ Inferno::Utils::Migration.new.run require 'inferno' Inferno::Application.finalize! -require Inferno::SpecSupport::FACTORY_BOT_SUPPORT_PATH +Inferno::SpecSupport.require_helpers FactoryBot.definition_file_paths = [ Inferno::SpecSupport::FACTORY_PATH