module RSpec
Constants
- MODULES_TO_AUTOLOAD
Public Class Methods
@private Used internally to clear remaining groups when fail_fast is set
# File lib/rspec/core.rb, line 125 def self.clear_remaining_example_groups world.example_groups.clear end
Returns the global [Configuration](RSpec/Core/Configuration) object. While you can use this method to access the configuration, the more common convention is to use [RSpec.configure](RSpec#configure-class_method).
@example
RSpec.configuration.drb_port = 1234
@see ::configure @see Core::Configuration
# File lib/rspec/core.rb, line 87 def self.configuration if block_given? RSpec.warn_deprecation <<-WARNING ***************************************************************** DEPRECATION WARNING * RSpec.configuration with a block is deprecated and has no effect. * please use RSpec.configure with a block instead. Called from #{caller(0)[1]} ***************************************************************** WARNING end @configuration ||= RSpec::Core::Configuration.new end
@private Used internally to set the global object
# File lib/rspec/core.rb, line 107 def self.configuration=(new_configuration) @configuration = new_configuration end
Yields the global configuration to a block. @yield [Configuration] global configuration
@example
RSpec.configure do |config| config.add_formatter 'documentation' end
@see Core::Configuration
# File lib/rspec/core.rb, line 119 def self.configure yield configuration if block_given? end
# File lib/rspec/core.rb, line 152 def self.const_missing(name) # Load rspec-expectations when RSpec::Matchers is referenced. This allows # people to define custom matchers (using `RSpec::Matchers.define`) before # rspec-core has loaded rspec-expectations (since it delays the loading of # it to allow users to configure a different assertion/expectation # framework). `autoload` can't be used since it works with ruby's built-in # require (e.g. for files that are available relative to a load path dir), # but not with rubygems' extended require. # # As of rspec 2.14.1, we no longer require `rspec/mocks` and # `rspec/expectations` when `rspec` is required, so we want # to make them available as an autoload. For more info, see: require MODULES_TO_AUTOLOAD.fetch(name) { return super } ::RSpec.const_get(name) end
@private Used internally to ensure examples get reloaded between multiple runs in the same process.
# File lib/rspec/core.rb, line 74 def self.reset @world = nil @configuration = nil end
@private
# File lib/rspec/core.rb, line 48 def self.wants_to_quit # Used internally to determine what to do when a SIGINT is received world.wants_to_quit end
@private Used internally to determine what to do when a SIGINT is received
# File lib/rspec/core.rb, line 55 def self.wants_to_quit=(maybe) world.wants_to_quit=(maybe) end
@private
# File lib/rspec/core.rb, line 130 def self.windows_os? RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/ end
@private Internal container for global non-configuration data
# File lib/rspec/core.rb, line 61 def self.world @world ||= RSpec::Core::World.new end
@private Used internally to set the global object
# File lib/rspec/core.rb, line 67 def self.world=(new_world) @world = new_world end