123456789_123456789_123456789_123456789_123456789_

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

Do not use. This module is for internal use only.

Overview

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

Class Method Summary

Instance Method Summary

Class Method Details

.has_default_failure_messages?(matcher) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/matchers/base_matcher.rb', line 167

def self.has_default_failure_messages?(matcher)
  matcher.method(:failure_message).owner == self &&
    matcher.method(:failure_message_when_negated).owner == self
rescue NameError
  false
end

Instance Method Details

#failure_messageString

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

[ GitHub ]

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

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

#failure_message_when_negatedString

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

[ GitHub ]

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

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