Module: RSpec

Defined in:
lib/rspec/core/version.rb,
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/errors.rb,
lib/rspec/core/runner.rb,
lib/rspec/core/example.rb,
lib/rspec/core/pending.rb,
lib/rspec/core/subject.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/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/expecting/with_rspec.rb,
lib/rspec/core/shared_example_group.rb,
lib/rspec/core/configuration_options.rb,
lib/rspec/core/expecting/with_stdlib.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/base_formatter.rb,
lib/rspec/core/formatters/html_formatter.rb,
lib/rspec/core/command_line_configuration.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

Overview

:nodoc:

Defined Under Namespace

Modules: Core, Rake, Runner Classes: HashWithDeprecationNotice

Constant Summary collapse

SharedContext =
Core::SharedContext

Class Method Summary collapse

Class Method Details

.clear_remaining_example_groupsObject

Used internally to clear remaining groups when fail_fast is set



83
84
85
# File 'lib/rspec/core.rb', line 83

def self.clear_remaining_example_groups
  world.example_groups.clear
end

.configurationObject

Returns the global configuration object



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

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

.configure {|configuration| ... } ⇒ Object

Yields the global configuration object

Examples

RSpec.configure do |config|

config.format = 'documentation'

end

Yields:



77
78
79
80
# File 'lib/rspec/core.rb', line 77

def self.configure
  warn_about_deprecated_configure if RSpec.world.example_groups.any?
  yield configuration if block_given?
end

.deprecate(method, alternate_method = nil, version = nil) ⇒ Object



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

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

.resetObject

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



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

def self.reset
  world.reset
  configuration.reset
end

.wants_to_quitObject

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



44
45
46
# File 'lib/rspec/core.rb', line 44

def self.wants_to_quit
  world.wants_to_quit
end

.wants_to_quit=(maybe) ⇒ Object

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



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

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

.warn_deprecation(message) ⇒ Object



27
28
29
# File 'lib/rspec/core/deprecation.rb', line 27

def warn_deprecation(message)
  send :warn, message
end

.worldObject

Internal container for global non-configuration data



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

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