Class: MRspec::Configuration

Inherits:
RSpec::Core::Configuration
  • Object
show all
Defined in:
lib/mrspec/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mrspec/configuration.rb', line 7

def initialize(*)
  super
  disable_monkey_patching!
  filter_gems_from_backtrace 'mrspec', 'minitest'
  self.pattern = pattern.sub '*_spec.rb', '{*_spec,*_test,test_*}.rb'
  self.default_formatter = WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
  WhatWeveGotHereIsAnErrorToCommunicate::ExceptionRecorder.record_exception_bindings(self)

  [Module, TOPLEVEL_BINDING.eval('self').singleton_class].each do |klass|
    klass.class_eval do
      def describe(*args, &block)
        Kernel.instance_method(:describe).bind(self).call(*args, &block)
      end
    end
  end
end

Instance Method Details

#add_formatter(*args) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/mrspec/configuration.rb', line 29

def add_formatter(*args)
  if args.any? { |formatter| formatter == 'w' || formatter =~ /^what/ }
    super WhatWeveGotHereIsAnErrorToCommunicate::RSpecFormatter
  else
    super
  end
end

#load_spec_filesObject



24
25
26
27
# File 'lib/mrspec/configuration.rb', line 24

def load_spec_files(*)
  super
  MRspec::DeclareMinitests.call(RSpec, Minitest, Minitest::Runnable.runnables)
end