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/version.rb,
lib/rspec/core/subject.rb,
lib/rspec/core/pending.rb,
lib/rspec/core/example.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/shared_context.rb,
lib/rspec/core/filter_manager.rb,
lib/rspec/core/mocking/with_rr.rb,
lib/rspec/core/drb_command_line.rb,
lib/rspec/core/formatters/helpers.rb,
lib/rspec/core/mocking/with_mocha.rb,
lib/rspec/core/mocking/with_rspec.rb,
lib/rspec/core/extensions/ordered.rb,
lib/rspec/core/project_initializer.rb,
lib/rspec/core/shared_example_group.rb,
lib/rspec/core/metadata_hash_builder.rb,
lib/rspec/core/mocking/with_flexmock.rb,
lib/rspec/core/configuration_options.rb,
lib/rspec/core/backward_compatibility.rb,
lib/rspec/core/formatters/html_formatter.rb,
lib/rspec/core/formatters/base_formatter.rb,
lib/rspec/core/formatters/snippet_extractor.rb,
lib/rspec/core/formatters/progress_formatter.rb,
lib/rspec/core/formatters/text_mate_formatter.rb,
lib/rspec/core/formatters/base_text_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, Rake, Runner Classes: HashWithDeprecationNotice

Constant Summary

SharedContext =
Core::SharedContext

Class Method Summary (collapse)

Class Method Details

+ (Object) clear_remaining_example_groups

Used internally to clear remaining groups when fail_fast is set



98
99
100
# File 'lib/rspec/core.rb', line 98

def self.clear_remaining_example_groups
  world.example_groups.clear
end

+ (Object) configuration

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).

Examples:

RSpec.configuration.drb_port = 1234

See Also:



80
81
82
# File 'lib/rspec/core.rb', line 80

def self.configuration
  @configuration ||= RSpec::Core::Configuration.new
end

+ (Object) configure {|Configuration| ... }

Yields the global configuration to a block.

Examples:

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

Yields:

  • (Configuration)

    global configuration

See Also:



92
93
94
# File 'lib/rspec/core.rb', line 92

def self.configure
  yield configuration if block_given?
end

+ (Object) deprecate(method, alternate_method = nil, version = nil)

Used internally to print deprecation warnings



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rspec/core/deprecation.rb', line 6

def deprecate(method, alternate_method=nil, version=nil)
  version_string = version ? "rspec-#{version}" : "a future version of RSpec"

  message = <<-NOTICE

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from #{version_string}.

#{caller(0)[2]}

* #{method} is deprecated.
NOTICE
  if alternate_method
    message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
  end

  message << "*****************************************************************"
  warn_deprecation(message)
end

+ (Object) reset

Used internally to ensure examples get reloaded between multiple runs in the same process.



67
68
69
70
# File 'lib/rspec/core.rb', line 67

def self.reset
  world.reset
  configuration.reset
end

+ (Object) wants_to_quit



47
48
49
50
# File 'lib/rspec/core.rb', line 47

def self.wants_to_quit
# Used internally to determine what to do when a SIGINT is received
  world.wants_to_quit
end

+ (Object) wants_to_quit=(maybe)

Used internally to determine what to do when a SIGINT is received



54
55
56
# File 'lib/rspec/core.rb', line 54

def self.wants_to_quit=(maybe)
  world.wants_to_quit=(maybe)
end

+ (Object) warn_deprecation(message)

Used internally to print deprecation warnings



32
33
34
# File 'lib/rspec/core/deprecation.rb', line 32

def warn_deprecation(message)
  send :warn, message
end

+ (Object) world

Internal container for global non-configuration data



60
61
62
# File 'lib/rspec/core.rb', line 60

def self.world
  @world ||= RSpec::Core::World.new
end