Module: RSpec::Rails::Matchers::BaseMatcher::DefaultFailureMessages Private

Included in:
RSpec::Rails::Matchers::BaseMatcher
Defined in:
lib/rspec/rails/matchers/base_matcher.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Provides default implementations of failure messages, based on the description.

Instance Method Summary collapse

Instance Method Details

#failure_messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provides a good generic failure message. Based on description. When subclassing, if you are not satisfied with this failure message you often only need to override description.

Returns:

  • (String)

153
154
155
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 153

def failure_message
  "expected #{description_of @actual} to #{description}".dup
end

#failure_message_when_negatedString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provides a good generic negative failure message. Based on description. When subclassing, if you are not satisfied with this failure message you often only need to override description.

Returns:

  • (String)

162
163
164
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 162

def failure_message_when_negated
  "expected #{description_of @actual} not to #{description}".dup
end