Sha256: bb67c731e357ce7bc4bc8bb1c6efaedb0b68b24c153cde1530f6386aa3fc862f

Contents?: true

Size: 1.23 KB

Versions: 14

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pathname'
require 'optparse'

module QonfigSpecRunner
  extend self

  expand_gemfile_path = lambda do |gemfile_name|
    File.expand_path(File.join('..', 'gemfiles', gemfile_name), __dir__)
  end

  GEMFILES = {
    with_external_deps: expand_gemfile_path.call('with_external_deps.gemfile'),
    without_external_deps: expand_gemfile_path.call('without_external_deps.gemfile')
  }.freeze

  def run!
    OptionParser.new do |opts|
      opts.banner = 'Usage: bin/rspec [options]'

      opts.on(
        '-w', '--with-plugins',
        'Run tests with test for plugins'
      ) { run_with_specs_for_plugins! }

      opts.on(
        '-n', '--without-plugins',
        'Run tests without tests for plugins'
      ) { run_without_specs_for_plugins! }
    end.parse!
  end

  private

  def run_with_specs_for_plugins!
    ENV['TEST_PLUGINS'] = 'true'
    ENV['BUNDLE_GEMFILE'] = GEMFILES[:with_external_deps]
    run_tests!
  end

  def run_without_specs_for_plugins!
    ENV['BUNDLE_GEMFILE'] = GEMFILES[:without_external_deps]
    run_tests!
  end

  def run_tests!
    require 'rubygems'
    require 'bundler/setup'
    load Gem.bin_path('rspec-core', 'rspec')
  end
end

QonfigSpecRunner.run!

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
qonfig-0.23.0 bin/rspec
qonfig-0.22.0 bin/rspec
qonfig-0.21.0 bin/rspec
qonfig-0.20.0 bin/rspec
qonfig-0.19.1 bin/rspec
qonfig-0.19.0 bin/rspec
qonfig-0.18.1 bin/rspec
qonfig-0.18.0 bin/rspec
qonfig-0.17.0 bin/rspec
qonfig-0.16.0 bin/rspec
qonfig-0.15.0 bin/rspec
qonfig-0.14.0 bin/rspec
qonfig-0.13.0 bin/rspec
qonfig-0.12.0 bin/rspec