multi_test-1.1.0/0000755000004100000410000000000014240757631013743 5ustar www-datawww-datamulti_test-1.1.0/Makefile0000644000004100000410000000012314240757631015377 0ustar www-datawww-dataall: ./test-all .PHONY: all clean: rm -f test/gemfiles/**/*.lock .PHONY: clean multi_test-1.1.0/multi_test.gemspec0000644000004100000410000000161214240757631017501 0ustar www-datawww-data# -*- encoding: utf-8 -*- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| s.name = 'multi_test' s.version = File.read(File.join(File.expand_path(__dir__),'VERSION')) s.authors = ["Matt Wynne", "Steve Tooke"] s.description = 'Wafter-thin gem to help control rogue test/unit/autorun requires' s.summary = "multi-test-#{s.version}" s.email = 'cukes@googlegroups.com' s.license = 'MIT' s.homepage = "http://cukes.info" s.platform = Gem::Platform::RUBY s.required_ruby_version = ">= 2.0" s.required_rubygems_version = ">= 1.6.1" s.files = `git ls-files`.split("\n"). reject { |path| path =~ /\.gitignore$/ }. reject { |path| path =~ /^test\// } s.test_files = `git ls-files -- {gemfiles,test}/*`.split("\n") s.rdoc_options = ["--charset=UTF-8"] s.require_path = "lib" end multi_test-1.1.0/README.md0000644000004100000410000000112114240757631015215 0ustar www-datawww-data[![Tests](https://github.com/cucumber/multi_test/actions/workflows/test-ruby.yml/badge.svg)](https://github.com/cucumber/multi_test/actions/workflows/test-ruby.yml) [![Gem Version](https://badge.fury.io/rb/multi_test.svg)](https://badge.fury.io/rb/multi_test) This project gives you a uniform interface onto whatever testing library has been loaded into a running Ruby process. We use this within cucumber-ruby to discover and auto-load your favourite assertion library Example: ~~~ruby require 'multi_test' my_tests = Object.new MultiTest.extend_with_best_assertion_library(my_tests) ~~~ multi_test-1.1.0/test-all0000755000004100000410000000012614240757631015415 0ustar www-datawww-data#!/bin/bash set -e for gemfile in test/gemfiles/*; do ./test-gemfile $gemfile done multi_test-1.1.0/CHANGELOG.md0000644000004100000410000000375714240757631015570 0ustar www-datawww-data# Changelog ## [Unreleased] ## [1.1.0] - 2022-05-11 ### Added - `MultiTest.disable_autorun` is back again! ([#33](https://github.com/cucumber/multi_test/issues/33) [#26](https://github.com/cucumber/multi_test/issues/26)) ## [1.0.0] - 2022-05-04 ### Changed - As per [#251](https://github.com/cucumber/cucumber/issues/251): renamed History.md to CHANGELOG.md, added contributing message at beginning, and other formatting. ([#12](https://github.com/cucumber/multi_test/pull/12) [jaysonesmith](https://github.com/jaysonesmith/)) ### Removed - Remove test files from the gem to prevent false-positive with security scanners as reported in [#21](https://github.com/cucumber/multi_test/issues/21) - Drop support for ruby < 2.0 ([PR#28](https://github.com/cucumber/multi_test/pull/28)) - Removed `disable_autorun` ([PR#30](https://github.com/cucumber/multi_test/pull/30) [Issue#26](https://github.com/cucumber/multi_test/issues/26)) ## [0.1.2] ### Changed - Ensure that detecting assetion library doesn't fail if no test framework included. Ruby 2.2 removed minitest from standard library. (@tooky, @jmoody) ## [0.1.1] ### Removed - Remove incompatibility with ruby 1.8.7 ## [0.1.0] ### Added - Detect best available assertion library for cucumber (@tooky) ## [0.0.3] ### Fixed - Fix for Rails 4.1, Minitest 5.x ([#4](https://github.com/cucumber/multi_test/pull/4) Andy Lindeman) ## [0.0.2] ### Changed - First gem release [Unreleased]: https://github.com/cucumber/multi_test/compare/1.0.0..main [1.1.0]: https://github.com/cucumber/multi_test/compare/1.0.0..main [1.0.0]: https://github.com/cucumber/multi_test/compare/v0.1.2..main [0.1.2]: https://github.com/cucumber/multi_test/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/cucumber/multi_test/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/cucumber/multi_test/compare/v0.0.3...v0.1.0 [0.0.3]: https://github.com/cucumber/multi_test/compare/v0.0.2...v0.0.3 [0.0.2]: https://github.com/cucumber/multi_test/compare/bae4b700eb63cfb4e95f7acc35e25683f697905a...v0.0.2 multi_test-1.1.0/test-gemfile0000755000004100000410000000117114240757631016256 0ustar www-datawww-data#!/bin/bash set -e GEMFILE_FOLDER=$1 GEMFILE=$GEMFILE_FOLDER/Gemfile echo echo $GEMFILE echo scenarios=$(cat $GEMFILE_FOLDER/scenarios) PLATFORM="$(BUNDLE_GEMFILE=$GEMFILE bundle platform)" if [[ "$PLATFORM" =~ "Your Ruby version is" ]]; then echo "$PLATFORM" echo echo "Skipping." exit 0 fi for scenario in $scenarios; do echo echo $scenario echo scenario_path=test/scenarios/$scenario BUNDLE_GEMFILE=$GEMFILE bundle install output=$(BUNDLE_GEMFILE=$GEMFILE bundle exec ruby -I lib test/scenarios/$scenario) if [[ ! -z $output ]]; then echo "Expected output to be empty, but was:" echo "$output" exit 1 fi donemulti_test-1.1.0/LICENSE0000644000004100000410000000205514240757631014752 0ustar www-datawww-dataCopyright (c) 2013 The Cucumber Organisation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. multi_test-1.1.0/lib/0000755000004100000410000000000014240757631014511 5ustar www-datawww-datamulti_test-1.1.0/lib/multi_test.rb0000644000004100000410000000133414240757631017230 0ustar www-datawww-datarequire 'multi_test/assertion_library' module MultiTest def self.disable_autorun if defined?(Test::Unit::Runner) Test::Unit::Runner.module_eval("@@stop_auto_run = true") end if defined?(Minitest) Minitest.instance_eval do def run(*) # propagate the exit code from cucumber or another runner case $! when SystemExit $!.status else true end end end if defined?(Minitest::Unit) Minitest::Unit.class_eval do def run(*) end end end end end def self.extend_with_best_assertion_library(object) AssertionLibrary.detect_best.extend_world(object) end end multi_test-1.1.0/lib/multi_test/0000755000004100000410000000000014240757631016702 5ustar www-datawww-datamulti_test-1.1.0/lib/multi_test/assertion_library.rb0000644000004100000410000000343014240757631022762 0ustar www-datawww-datarequire 'multi_test/minitest_world' module MultiTest class AssertionLibrary def self.detect_best available.detect(&:require?) end def initialize(requirer, extender) @requirer = requirer @extender = extender end def require? begin @requirer.call true rescue LoadError false end end def extend_world(world) @extender.call(world) end private def self.null AssertionLibrary.new( proc { }, proc { } ) end def self.available @available ||= [ AssertionLibrary.new( proc { require 'rspec/expectations' }, proc { |object| object.extend(::RSpec::Matchers) } ), AssertionLibrary.new( proc { require 'spec/expectations' require 'spec/runner/differs/default' require 'ostruct' }, proc { |object| options = OpenStruct.new(:diff_format => :unified, :context_lines => 3) Spec::Expectations.differ = Spec::Expectations::Differs::Default.new(options) object.extend(Spec::Matchers) } ), AssertionLibrary.new( proc { require 'minitest/assertions' }, proc { |object| object.extend(MinitestWorld) } ), AssertionLibrary.new( proc { require 'minitest/unit' }, proc { |object| object.extend(MiniTest::Assertions) } ), AssertionLibrary.new( proc { require 'test/unit/assertions' }, proc { |object| object.extend(Test::Unit::Assertions) } ), # Null assertion library must come last to prevent exceptions if # unable to load a test framework AssertionLibrary.null ] end end end multi_test-1.1.0/lib/multi_test/minitest_world.rb0000644000004100000410000000026714240757631022277 0ustar www-datawww-datamodule MultiTest module MinitestWorld def self.extended(base) base.extend(Minitest::Assertions) base.assertions = 0 end attr_accessor :assertions end end multi_test-1.1.0/.whitesource0000644000004100000410000000044414240757631016307 0ustar www-datawww-data{ "scanSettings": { "configMode": "AUTO", "configExternalURL": "", "projectToken": "", "baseBranches": [] }, "checkRunSettings": { "vulnerableCheckRunConclusionLevel": "failure", "displayMode": "diff" }, "issueSettings": { "minSeverityLevel": "LOW" } }multi_test-1.1.0/.github/0000755000004100000410000000000014240757631015303 5ustar www-datawww-datamulti_test-1.1.0/.github/CODEOWNERS0000644000004100000410000000005014240757631016671 0ustar www-datawww-data.github/settings.yml @cucumber/settings multi_test-1.1.0/.github/settings.yml0000644000004100000410000000411614240757631017670 0ustar www-datawww-data_extends: .github branches: - name: main protection: required_pull_request_reviews: null required_status_checks: null restrictions: null enforce_admins: true # https://github.com/cucumber/multi_test # https://github.com/cucumber/multi_test # # https://docs.github.com/en/rest/reference/repos#update-branch-protection # # Branch Protection settings. # protection: # # Required. Require at least one approving review on a pull request, before merging. Set to null to disable. # required_pull_request_reviews: # # The number of approvals required. (1-6) # required_approving_review_count: 0 # # Dismiss approved reviews automatically when a new commit is pushed. # dismiss_stale_reviews: true # # Blocks merge until code owners have reviewed. # require_code_owner_reviews: true # # Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories. # dismissal_restrictions: # users: [] # teams: [] # # Required. Require status checks to pass before merging. Set to null to disable # required_status_checks: # # Required. Require branches to be up to date before merging. # strict: true # # Required. The list of status checks to require in order to merge into this branch # contexts: [] # # Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable. # enforce_admins: true # # Prevent merge commits from being pushed to matching branches # required_linear_history: true # # Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable. # restrictions: # apps: [] # users: [] # teams: [] multi_test-1.1.0/.github/workflows/0000755000004100000410000000000014240757631017340 5ustar www-datawww-datamulti_test-1.1.0/.github/workflows/release-ruby.yml0000644000004100000410000000130214240757631022456 0ustar www-datawww-dataname: Release ruby gem on: push: branches: - release/* jobs: pre-release-check: uses: cucumber/.github/.github/workflows/prerelease-checks.yml@main test-ruby: uses: ./.github/workflows/test-ruby.yml publish-rubygem: name: Publish Ruby Gem needs: [pre-release-check, test-ruby] runs-on: ubuntu-latest environment: Release steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: "3.0" bundler-cache: true - name: Publish ruby gem uses: cucumber/action-publish-rubygem@v1.0.0 with: rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }} multi_test-1.1.0/.github/workflows/test-ruby.yml0000644000004100000410000000165514240757631022030 0ustar www-datawww-dataname: Test on: push: branches: - main pull_request: branches: - main schedule: - cron: "0 0 * * *" workflow_call: jobs: test: strategy: fail-fast: false matrix: os: [ubuntu-latest] ruby: ["2.6", "2.7", "3.0", "3.1"] gemfile: # These are duplicated from the test/gemfiles folder - activesupport-4 - activesupport-5 - minitest-4 - minitest-5 - plain-ruby - rspec-1 - rspec-2 - rspec-3 - test-unit-2 - test-unit-3 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: false - name: Run test scenarios run: | ./test-gemfile test/gemfiles/${{ matrix.gemfile }} shell: bash multi_test-1.1.0/.github/workflows/release-github.yml0000644000004100000410000000102414240757631022760 0ustar www-datawww-dataname: Release on github on: push: branches: - release/* jobs: pre-release-check: uses: cucumber/.github/.github/workflows/prerelease-checks.yml@main create-github-release: name: Create Git tag and GitHub Release needs: [pre-release-check] runs-on: ubuntu-latest environment: Release permissions: contents: write steps: - uses: actions/checkout@v3 - uses: cucumber/action-create-github-release@v1.1.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} multi_test-1.1.0/VERSION0000644000004100000410000000000614240757631015007 0ustar www-datawww-data1.1.0