Skip to content

Commit

Permalink
update template for runnable helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammjammjamm committed Nov 19, 2024
1 parent cac216a commit 4196492
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 4 additions & 0 deletions lib/inferno/apps/cli/templates/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ gemspec
group :development, :test do
gem 'debug'
end

group :test do
gem 'rack-test'
end
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4196492

Please sign in to comment.