class RSpec::Expectations::Configuration

RSpec::Expectations.configuration
# or
end
end
# c is the config object
rspec.expect_with :rspec do |c|
RSpec.configure do |rspec|
@example
Otherwise, you can access it via RSpec::Expectations.configuration.
block passed to ‘RSpec::Core::Configuration#expect_with`.
If you are using rspec-core, you can access this via a
Provides configuration options for rspec-expectations.

def add_should_and_should_not_to(*modules)

Parameters:
  • modules (Array) -- the list of classes or modules
def add_should_and_should_not_to(*modules)
  modules.each do |mod|
    Expectations::Syntax.enable_should(mod)
  end
end

def backtrace_formatter

def backtrace_formatter
  @backtrace_formatter ||= if defined?(::RSpec.configuration.backtrace_formatter)
                             ::RSpec.configuration.backtrace_formatter
                           else
                             NullBacktraceFormatter
                           end
end

def color?

def color?
  ::RSpec.configuration.color_enabled?
end

def color?

is loaded; otherwise you can set it here.
Delegates to rspec-core's color option if rspec-core
Indicates whether or not diffs should be colored.
def color?
  defined?(@color) && @color
end

def false_positives_handler

Other tags:
    Private: -
def false_positives_handler
  FALSE_POSITIVE_BEHAVIOURS.fetch(@on_potential_false_positives)
end

def include_chain_clauses_in_custom_matcher_descriptions?

false by default for backwards compatibility.
should include clauses from methods defined using `chain`. It is
Indicates whether or not custom matcher descriptions and failure messages
def include_chain_clauses_in_custom_matcher_descriptions?
  @include_chain_clauses_in_custom_matcher_descriptions ||= false
end

def initialize

def initialize
  @on_potential_false_positives = :warn
  @strict_predicate_matchers = false
end

def max_formatted_output_length=(length)

Parameters:
  • length (Fixnum) -- the number of characters to limit the formatted output to.
def max_formatted_output_length=(length)
  RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = length
end

def on_potential_false_positives=(behavior)

Parameters:
  • behavior (Symbol) -- can be set to :warn, :raise or :nothing
def on_potential_false_positives=(behavior)
  unless FALSE_POSITIVE_BEHAVIOURS.key?(behavior)
    raise ArgumentError, "Supported values are: #{FALSE_POSITIVE_BEHAVIOURS.keys}"
  end
  @on_potential_false_positives = behavior
end

def reset_syntaxes_to_default

Other tags:
    Private: -
def reset_syntaxes_to_default
  self.syntax = [:should, :expect]
  RSpec::Expectations::Syntax.warn_about_should!
end

def strict_predicate_matchers=(flag)

Historically, the default was `false`, but `true` is recommended.
or `be_truthy` / `be_falsey` (not strict).
Configures RSpec to check predicate matchers to `be(true)` / `be(false)` (strict),
def strict_predicate_matchers=(flag)
  raise ArgumentError, "Pass `true` or `false`" unless flag == true || flag == false
  @strict_predicate_matchers = flag
end

def strict_predicate_matchers?

def strict_predicate_matchers?
  @strict_predicate_matchers
end

def syntax

Returns:
  • (Array) - the list of configured syntaxes.
def syntax
  syntaxes = []
  syntaxes << :should if Expectations::Syntax.should_enabled?
  syntaxes << :expect if Expectations::Syntax.expect_enabled?
  syntaxes
end

def syntax=(values)

Parameters:
  • values (Array, Symbol) -- the syntaxes to enable
def syntax=(values)
  if Array(values).include?(:expect)
    Expectations::Syntax.enable_expect
  else
    Expectations::Syntax.disable_expect
  end
  if Array(values).include?(:should)
    Expectations::Syntax.enable_should
  else
    Expectations::Syntax.disable_should
  end
end

def warn_about_potential_false_positives=(boolean)

Parameters:
  • boolean (Boolean) --
def warn_about_potential_false_positives=(boolean)
  if boolean
    self.on_potential_false_positives = :warn
  elsif warn_about_potential_false_positives?
    self.on_potential_false_positives = :nothing
  else
    # no-op, handler is something else
  end
end

def warn_about_potential_false_positives?

avoid such scenarios so this defaults to `true`.
potentially cause false positives in tests, generally you want to
Indicates whether RSpec will warn about matcher use which will
def warn_about_potential_false_positives?
  on_potential_false_positives == :warn
end