Module: Remarkable::Messages

Included in:
Base
Defined in:
lib/remarkable/messages.rb

Overview

Holds the methods required by rspec for each matcher plus a collection of helpers to deal with I18n.

Instance Method Summary collapse

Instance Method Details

#description(options = {}) ⇒ Object

Provides a default description message. Overwrite it if needed. By default it uses default i18n options, but without the subjects, which usually are not available when description is called.



11
12
13
14
15
16
17
18
19
# File 'lib/remarkable/messages.rb', line 11

def description(options={})
  options = default_i18n_options.merge(options)

  # Remove subject keys
  options.delete(:subject_name)
  options.delete(:subject_inspect)

  Remarkable.t 'description', options
end

#failure_message_for_shouldObject Also known as: failure_message

Provides a default failure message. Overwrite it if needed.



23
24
25
# File 'lib/remarkable/messages.rb', line 23

def failure_message_for_should
  Remarkable.t 'remarkable.core.failure_message_for_should', :expectation => @expectation
end

#failure_message_for_should_notObject Also known as: negative_failure_message

Provides a default negative failure message. Overwrite it if needed.



30
31
32
# File 'lib/remarkable/messages.rb', line 30

def failure_message_for_should_not
  Remarkable.t 'remarkable.core.failure_message_for_should_not', :expectation => @expectation
end