Sha256: d04c5e36b034fd64e5ea7ed2dfa9be8af2b559e6838f095c5bcabc34ad1ec0ef

Contents?: true

Size: 919 Bytes

Versions: 10

Compression:

Stored size: 919 Bytes

Contents

require 'optparse'

module Spec #:nodoc:
  module Runner #:nodoc:
    # Lucid uses OptionParser in order to parse any command line options.
    # If RSpec is being used in any way with Lucid, then what will happen
    # is that RSpec's option parser will kick in and try to parse ARGV.
    # Since the command line arguments will be specific to Lucid, RSpec
    # will not know what to do with them and will fail. So what this bit
    # of logic is doing is making sure that the option parser for RSpec
    # will not be operative.
    class OptionParser < ::OptionParser #:nodoc:
      MODDED_RSPEC = Object.new
      def MODDED_RSPEC.method_missing(m, *args); self; end

      def self.method_added(m)
        unless @__modding_rspec
          @__modding_rspec = true
          define_method(m) do |*a|
            MODDED_RSPEC
          end
          @__modding_rspec = false
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lucid-0.3.0 lib/lucid/rspec/disallow_options.rb
lucid-0.2.1 lib/lucid/rspec/disallow_options.rb
lucid-0.2.0 lib/lucid/rspec/disallow_options.rb
lucid-0.1.1 lib/lucid/rspec/disallow_options.rb
lucid-0.1.0 lib/lucid/rspec/disallow_options.rb
lucid-0.0.9 lib/lucid/rspec/disallow_options.rb
lucid-0.0.8 lib/lucid/rspec/disallow_options.rb
lucid-0.0.7 lib/lucid/rspec/disallow_options.rb
lucid-0.0.6 lib/lucid/rspec/disallow_options.rb
lucid-0.0.5 lib/lucid/rspec/disallow_options.rb