class RSpec::SleepingKingStudios::Configuration::Examples

Configuration options for RSpec::SleepingKingStudios::Examples.

Constants

MISSING_FAILURE_MESSAGE_HANDLERS

Permitted options for :handle_missing_failure_message_with.

STRING_FAILURE_MESSAGE_MATCH_OPTIONS

Options for matching failure messages to strings.

Public Instance Methods

handle_missing_failure_message_with() click to toggle source

Gets the handler for missing failure messages when using the matcher examples, and sets to :pending if unset.

@return [Symbol] The current missing message handler.

# File lib/rspec/sleeping_king_studios/configuration.rb, line 20
def handle_missing_failure_message_with
  @handle_missing_failure_message_with ||= :pending
end
handle_missing_failure_message_with=(value) click to toggle source

Sets the handler for missing failure messages when using the matcher examples.

@param [Symbol] value The desired handler. Must be :ignore, :pending,

or :exception.

@raise ArgumentError If the handler is not one of the recognized

values.
# File lib/rspec/sleeping_king_studios/configuration.rb, line 32
def handle_missing_failure_message_with= value
  value = value.to_s.intern

  unless MISSING_FAILURE_MESSAGE_HANDLERS.include?(value)
    message = "unrecognized handler value -- must be in #{MISSING_FAILURE_MESSAGE_HANDLERS.join ', '}"

    raise ArgumentError.new message
  end # unless

  @handle_missing_failure_message_with = value
end
match_string_failure_message_as() click to toggle source

Gets the option for matching failure messages to strings, and sets to :substring if unset.

@return [Symbol] The current failure message string matching option.

# File lib/rspec/sleeping_king_studios/configuration.rb, line 48
def match_string_failure_message_as
  @match_string_failure_message_as ||= :substring
end
match_string_failure_message_as=(value) click to toggle source

Sets the option for matching failure messages to strings.

@param [Symbol] value The desired option. Must be :exact, :substring, or

:partial (alias of :substring).

@raise ArgumentError If the handler is not one of the recognized

values.
# File lib/rspec/sleeping_king_studios/configuration.rb, line 59
def match_string_failure_message_as= value
  value = value.to_s.intern
  value = :substring if value == :partial

  unless STRING_FAILURE_MESSAGE_MATCH_OPTIONS.include?(value)
    message = "unrecognized value -- must be in #{STRING_FAILURE_MESSAGE_MATCH_OPTIONS.join ', '}"

    raise ArgumentError.new message
  end # unless

  @match_string_failure_message_as = value
end