miniswag 0.1.7 → 0.1.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e74ccbc7d9744dc4764d42bee62e529e3d0e1af32498ec100f9476f323ce87fb
4
- data.tar.gz: 64c482062e16ff3a416081c3eaea73bef3ac7d58676b89e148b99fc96a815fde
3
+ metadata.gz: 3addfce7769bc58d8ea148bc58a9499e40347766919a7a43507c22ccbc68e38a
4
+ data.tar.gz: 58c6331cb1b626bea73f08b2a42dc59bc8e7213bf158f3d97d9dc9ac07bfd92c
5
5
  SHA512:
6
- metadata.gz: 91f6721bbf24b0e51d4c9d1464cb34fae135d7fead2fdb95f1847994df2d31a20c11423296bd0918efe98f66432501432c543aadabca5a91d8ba5ebc8f57e5e3
7
- data.tar.gz: 8e80c7bc672ced286837ca71853a60f320708869597249c7d318716e659b8a20a2bcabbb48a5fafb9a9d78aa07b700c9f3c6be379a3da9d672ccfcd286096bad
6
+ metadata.gz: 7ba9c82d1e47f4ebf01df7caf23e4db2cef4a2e4bc01355c6541855a90610472d78a0e411bfb09d64c8dabbd690caba4a2fd0af66a3058b00c0d699e81c07160
7
+ data.tar.gz: 6e1308ead44249f7628a88900ff86900279bfce6116f93b7db2cfc0106afc001ea5b8dbc8c3fec73966bfc3e9b7cd5c75252516ee8788a0bffc4a80d6efc60c7
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miniswag
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.9'
5
5
  end
@@ -4,16 +4,17 @@ require 'minitest'
4
4
 
5
5
  module Minitest
6
6
  # Minitest plugin that triggers OpenAPI generation after the test suite.
7
- # Activated by setting MINISWAG_GENERATE=1 or via the rake task.
7
+ # Always active generates specs after every green test run.
8
+ # Set MINISWAG_DRY_RUN=1 to skip generation.
8
9
  def self.plugin_miniswag_init(options)
9
- return unless ENV['MINISWAG_GENERATE'] == '1'
10
+ return if ENV['MINISWAG_DRY_RUN'] == '1'
10
11
 
11
12
  reporter << Miniswag::Reporter.new(options[:io], options)
12
13
  end
13
14
 
14
15
  def self.plugin_miniswag_options(opts, _options)
15
- opts.on '--miniswag-generate', 'Generate OpenAPI specs after test run' do
16
- ENV['MINISWAG_GENERATE'] = '1'
16
+ opts.on '--no-miniswag', 'Skip OpenAPI spec generation after test run' do
17
+ ENV['MINISWAG_DRY_RUN'] = '1'
17
18
  end
18
19
  end
19
20
  end
@@ -23,6 +24,8 @@ module Miniswag
23
24
  def report
24
25
  super
25
26
  return if errors > 0 || failures > 0
27
+ return if Miniswag.registered_test_classes.empty?
28
+ return unless Miniswag.config.openapi_root && Miniswag.config.openapi_specs&.any?
26
29
 
27
30
  puts 'Miniswag: Generating OpenAPI specs...'
28
31
  require 'miniswag/openapi_generator'
@@ -6,11 +6,8 @@ namespace :miniswag do
6
6
  pattern = ENV.fetch('PATTERN', 'test/integration/**/*_test.rb')
7
7
  additional_opts = ENV.fetch('ADDITIONAL_OPTS', '')
8
8
 
9
- # Set the env var so the minitest plugin activates in the subprocess
10
- ENV['MINISWAG_GENERATE'] = '1'
11
-
12
9
  # Run minitest with the matching pattern
13
- # The openapi_helper is loaded by the test files themselves via require "openapi_helper"
10
+ # The miniswag plugin auto-generates specs after a green test run
14
11
  args = [
15
12
  'bin/rails', 'test',
16
13
  *Dir.glob(pattern),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miniswag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edem Kumodzi