You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

disable_option_parser.rb 715 B

2 years ago
1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. require 'optparse'
  3. module Spec # :nodoc:
  4. module Runner # :nodoc:
  5. # Neuters RSpec's option parser.
  6. # (RSpec's option parser tries to parse ARGV, which
  7. # will fail when running cucumber)
  8. class OptionParser < ::OptionParser # :nodoc:
  9. NEUTERED_RSPEC = Object.new
  10. def NEUTERED_RSPEC.method_missing(_method, *_args) # rubocop:disable Style/MissingRespondToMissing
  11. self || super
  12. end
  13. def self.method_added(method)
  14. return if @__neutering_rspec
  15. @__neutering_rspec = true
  16. define_method(method) do |*_a|
  17. NEUTERED_RSPEC
  18. end
  19. @__neutering_rspec = false
  20. super
  21. end
  22. end
  23. end
  24. end

No Description

Contributors (1)