inferno_core 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ module Inferno
2
+ # @private
3
+ module RouteStorage
4
+ def routes
5
+ @routes ||= []
6
+ end
7
+ end
8
+
9
+ extend RouteStorage
10
+ end
@@ -7,11 +7,13 @@ module Inferno
7
7
  FACTORY_PATH = File.expand_path('../../spec/factories', __dir__).freeze
8
8
  REQUEST_HELPER_PATH = File.expand_path('../../spec/request_helper', __dir__).freeze
9
9
  RUNNABLE_HELPER_PATH = File.expand_path('../../spec/runnable_helper', __dir__).freeze
10
+ TEST_KIT_SPEC = File.expand_path('../../spec/shared/test_kit_examples', __dir__).freeze
10
11
 
11
12
  def self.require_helpers
12
13
  require FACTORY_BOT_SUPPORT_PATH
13
14
  require RUNNABLE_HELPER_PATH
14
15
  require REQUEST_HELPER_PATH
16
+ require TEST_KIT_SPEC
15
17
  end
16
18
  end
17
19
  end
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.5.4'.freeze
3
+ VERSION = '0.6.0'.freeze
4
4
  end
data/lib/inferno.rb CHANGED
@@ -1,7 +1,4 @@
1
1
  module Inferno
2
- def self.routes
3
- @routes ||= []
4
- end
5
2
  end
6
3
 
7
4
  require_relative 'inferno/config/application'
@@ -14,3 +11,4 @@ require_relative 'inferno/spec_support'
14
11
  require_relative 'inferno/test_runner'
15
12
  require_relative 'inferno/version'
16
13
  require_relative 'inferno/utils/static_assets'
14
+ require_relative 'inferno/route_storage'
@@ -0,0 +1,133 @@
1
+ RSpec.shared_examples 'platform_deployable_test_kit' do
2
+ let(:test_kit_location) do
3
+ Object.const_source_location(described_class.name).first
4
+ end
5
+ let(:test_kit_gem) do
6
+ Bundler.definition.specs.find { |gem| test_kit_location.start_with? gem.full_gem_path }
7
+ end
8
+ let(:base_path) do
9
+ test_kit_gem.full_gem_path
10
+ end
11
+ let(:test_kit) do
12
+ described_class.const_get('Metadata')
13
+ rescue NameError
14
+ skip 'TestKit must be defined first'
15
+ end
16
+ let(:suites) do
17
+ test_kit.suite_ids.map { |id| Inferno::Repositories::TestSuites.new.find(id) }
18
+ end
19
+
20
+ describe 'TestKit' do
21
+ it 'defines test kit in the Metadata class' do
22
+ error_message =
23
+ "Define #{described_class.name}::Metadata at " \
24
+ "lib/#{described_class.name.underscore}/metadata.rb and require it in " \
25
+ "lib/#{described_class.name.underscore}.rb\n"
26
+
27
+ expect { described_class.const_get('Metadata') }.to_not raise_error(NameError), error_message
28
+
29
+ expect(described_class.const_get('Metadata') < Inferno::Entities::TestKit).to be(true)
30
+ end
31
+
32
+ it 'defines all required fields' do
33
+ required_fields = [
34
+ :id,
35
+ :title,
36
+ :description,
37
+ :suite_ids,
38
+ :version,
39
+ :maturity
40
+ ]
41
+
42
+ required_fields.each do |field_name|
43
+ expect(test_kit.send(field_name)).to be_present
44
+ end
45
+ end
46
+
47
+ it 'has a description with a <!-- break -->' do
48
+ error_message =
49
+ 'The test kit description must begin with one paragraph followed by "<!-- ' \
50
+ 'break -->". The portion of the description above the break is displayed ' \
51
+ "on the test kit listing page.\n"
52
+
53
+ expect(test_kit.description).to include('<!-- break -->'), error_message
54
+ end
55
+
56
+ it 'has a maturity of "Low", "Medium", or "High"' do
57
+ expect(['Low', 'Medium', 'High']).to include(test_kit.maturity) # rubocop:disable RSpec/ExpectActual
58
+ end
59
+
60
+ it 'uses the correct ruby version in its Dockerfile' do
61
+ dockerfile_path = File.join(base_path, 'Dockerfile')
62
+ dockerfile_contents = File.read(dockerfile_path)
63
+
64
+ expect(dockerfile_contents.lines.first.chomp).to eq('FROM ruby:3.3.6')
65
+ end
66
+ end
67
+
68
+ describe 'suites' do
69
+ it 'relies on the test kit version rather than defining the version in the suites' do
70
+ suite_paths = suites.map { |suite| Object.const_source_location(suite.name).first }
71
+ suite_contents = suite_paths.map { |path| File.read(path) }
72
+
73
+ suite_contents.each_with_index do |suite, i|
74
+ error_message =
75
+ "Suite at #{suite_paths[i]} should not explicitly declare a version, as " \
76
+ 'its version can now be determined by the version of its Test Kit.' \
77
+ "Remove the `version` method call in the suite definition.\n"
78
+
79
+ expect(suite).to_not match(/^\s+version(\s|\()\S+\)?/), error_message
80
+ end
81
+ end
82
+
83
+ it 'contains standard links' do
84
+ suites.each do |suite|
85
+ link_labels = suite.links.map { |link| link[:label] }
86
+
87
+ expected_labels = ['Report Issue', 'Open Source', 'Download']
88
+
89
+ error_message =
90
+ "Include the standard 'Report Issue', 'Open Source', and 'Download links in " \
91
+ 'each suite.\n'
92
+ expect(link_labels).to match_array(expected_labels), error_message
93
+ end
94
+ end
95
+ end
96
+
97
+ describe 'presets' do
98
+ it 'includes presets in the gem' do
99
+ presets = Dir[
100
+ File.join(base_path, 'config', 'presets', '*.json'),
101
+ File.join(base_path, 'config', 'presets', '*.json.erb')
102
+ ].map { |file_path| file_path.delete_prefix "#{Dir.pwd}/" }
103
+
104
+ missing_presets = presets - test_kit_gem.files
105
+
106
+ error_message =
107
+ "The following presets are not included in the gem: #{missing_presets.join(', ')}\n" \
108
+ "Ensure that config/presets is included in spec.files in #{test_kit_gem.name}.gemspec"
109
+
110
+ expect(missing_presets).to be_empty, error_message
111
+ end
112
+ end
113
+
114
+ describe 'gemspec' do
115
+ it 'uses git to determine files to include in the gem' do
116
+ gemspec_contents = File.read(File.join(base_path, "#{test_kit_gem.name}.gemspec"))
117
+
118
+ error_message =
119
+ 'Use git to determine which files to include in the gem. In ' \
120
+ "#{test_kit_gem.name}.gemspec, use: " \
121
+ "spec.files = `[ -d .git ] && git ls-files -z lib config/presets LICENSE`.split(\"\\x0\")\n"
122
+
123
+ expect(gemspec_contents).to include('[ -d .git ] && git ls-files'), error_message
124
+ end
125
+
126
+ it 'includes the inferno test kit metadata tag' do
127
+ error_message =
128
+ %(Add "spec.metadata['inferno_test_kit'] = 'true'" to #{test_kit_gem.name}.gemspec)
129
+
130
+ expect(test_kit_gem.metadata['inferno_test_kit']).to eq('true'), error_message
131
+ end
132
+ end
133
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-12-19 00:00:00.000000000 Z
13
+ date: 2025-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -412,6 +412,7 @@ files:
412
412
  - lib/inferno/apps/cli/templates/.env.test
413
413
  - lib/inferno/apps/cli/templates/.gitignore
414
414
  - lib/inferno/apps/cli/templates/.rspec
415
+ - lib/inferno/apps/cli/templates/.rubocop.yml
415
416
  - lib/inferno/apps/cli/templates/.ruby-version
416
417
  - lib/inferno/apps/cli/templates/.tool-versions
417
418
  - lib/inferno/apps/cli/templates/Dockerfile.tt
@@ -586,6 +587,7 @@ files:
586
587
  - lib/inferno/repositories/validator_sessions.rb
587
588
  - lib/inferno/result_collection.rb
588
589
  - lib/inferno/result_summarizer.rb
590
+ - lib/inferno/route_storage.rb
589
591
  - lib/inferno/spec_support.rb
590
592
  - lib/inferno/test_runner.rb
591
593
  - lib/inferno/utils/ig_downloader.rb
@@ -614,6 +616,7 @@ files:
614
616
  - spec/request_helper.rb
615
617
  - spec/runnable_context.rb
616
618
  - spec/runnable_helper.rb
619
+ - spec/shared/test_kit_examples.rb
617
620
  - spec/spec_helper.rb
618
621
  - spec/support/factory_bot.rb
619
622
  homepage: https://github.com/inferno-framework/inferno-core
@@ -632,14 +635,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
632
635
  requirements:
633
636
  - - "~>"
634
637
  - !ruby/object:Gem::Version
635
- version: 3.1.2
638
+ version: 3.3.6
636
639
  required_rubygems_version: !ruby/object:Gem::Requirement
637
640
  requirements:
638
641
  - - ">="
639
642
  - !ruby/object:Gem::Version
640
643
  version: '0'
641
644
  requirements: []
642
- rubygems_version: 3.3.7
645
+ rubygems_version: 3.5.22
643
646
  signing_key:
644
647
  specification_version: 4
645
648
  summary: Inferno Core is an open source tool for testing data exchanges enabled by