miniswag 0.1.6 → 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: 434d06b45f141df2f6c446e4255ebac027599bfd82f06318c820b158e1c04a21
4
- data.tar.gz: d45e14ddf12d6b2968dfaeee7f11cfc3c42c2c4acfa61ad24b89b92940db415c
3
+ metadata.gz: 3addfce7769bc58d8ea148bc58a9499e40347766919a7a43507c22ccbc68e38a
4
+ data.tar.gz: 58c6331cb1b626bea73f08b2a42dc59bc8e7213bf158f3d97d9dc9ac07bfd92c
5
5
  SHA512:
6
- metadata.gz: 319d2d350279345504db4cfbc5ebe9689d578f4d22f33acdad7078ec5ffeb82913d20e624d2d35d074c915e149a7b0e423f55e7a157ab69d58a56308ed4ba320
7
- data.tar.gz: 7ff7cd93c7fefd971c7df2ace4a3160b1079e23e9d21d6de62e9b9498012733e394c47756952076b3a1b397f0089153436be5d488d9491f35655f49187e27ff1
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.6'
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.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edem Kumodzi
@@ -122,13 +122,13 @@ files:
122
122
  - lib/miniswag/configuration.rb
123
123
  - lib/miniswag/dsl.rb
124
124
  - lib/miniswag/extended_schema.rb
125
- - lib/miniswag/minitest_plugin.rb
126
125
  - lib/miniswag/openapi_generator.rb
127
126
  - lib/miniswag/railtie.rb
128
127
  - lib/miniswag/request_factory.rb
129
128
  - lib/miniswag/response_validator.rb
130
129
  - lib/miniswag/test_case.rb
131
130
  - lib/miniswag/version.rb
131
+ - lib/minitest/miniswag_plugin.rb
132
132
  - lib/tasks/miniswag_tasks.rake
133
133
  homepage: https://github.com/edemkumodzi/miniswag
134
134
  licenses: