Module: RSpec

Defined in:
lib/rspec/core.rb,
lib/rspec/core/dsl.rb,
lib/rspec/core/let.rb,
lib/rspec/core/hooks.rb,
lib/rspec/core/world.rb,
lib/rspec/core/runner.rb,
lib/rspec/core/example.rb,
lib/rspec/core/pending.rb,
lib/rspec/core/subject.rb,
lib/rspec/core/version.rb,
lib/rspec/core/metadata.rb,
lib/rspec/core/rake_task.rb,
lib/rspec/core/deprecation.rb,
lib/rspec/core/command_line.rb,
lib/rspec/core/ruby_project.rb,
lib/rspec/core/configuration.rb,
lib/rspec/core/example_group.rb,
lib/rspec/core/filter_manager.rb,
lib/rspec/core/shared_context.rb,
lib/rspec/core/mocking/with_rr.rb,
lib/rspec/core/drb_command_line.rb,
lib/rspec/core/extensions/ordered.rb,
lib/rspec/core/formatters/helpers.rb,
lib/rspec/core/mocking/with_mocha.rb,
lib/rspec/core/mocking/with_rspec.rb,
lib/rspec/core/project_initializer.rb,
lib/rspec/core/shared_example_group.rb,
lib/rspec/core/configuration_options.rb,
lib/rspec/core/metadata_hash_builder.rb,
lib/rspec/core/mocking/with_flexmock.rb,
lib/rspec/core/backward_compatibility.rb,
lib/rspec/core/formatters/html_printer.rb,
lib/rspec/core/formatters/base_formatter.rb,
lib/rspec/core/formatters/html_formatter.rb,
lib/rspec/core/formatters/json_formatter.rb,
lib/rspec/core/formatters/snippet_extractor.rb,
lib/rspec/core/formatters/progress_formatter.rb,
lib/rspec/core/formatters/base_text_formatter.rb,
lib/rspec/core/formatters/text_mate_formatter.rb,
lib/rspec/core/mocking/with_absolutely_nothing.rb,
lib/rspec/core/extensions/module_eval_with_args.rb,
lib/rspec/core/extensions/instance_eval_with_args.rb,
lib/rspec/core/formatters/documentation_formatter.rb

Defined Under Namespace

Modules: Core, Runner

Constant Summary collapse

SharedContext =
Core::SharedContext

Class Method Summary collapse

Class Method Details

.configurationObject

Returns the global Configuration object. While you can use this method to access the configuration, the more common convention is to use RSpec.configure.

Examples:

RSpec.configuration.drb_port = 1234

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/rspec/core.rb', line 81

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

.configure {|Configuration| ... } ⇒ Object

Yields the global configuration to a block.

Examples:

RSpec.configure do |config|
  config.add_formatter 'documentation'
end

Yields:

  • (Configuration)

    global configuration

See Also:



107
108
109
# File 'lib/rspec/core.rb', line 107

def self.configure
  yield configuration if block_given?
end

.const_missing(name) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/rspec/core.rb', line 130

def self.const_missing(name)
  case name
    when :Matchers
      # 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.
      require 'rspec/expectations'
      ::RSpec::Matchers
    else super
  end
end