Class: RSpec::SleepingKingStudios::Matchers::ActiveModel::HaveErrors::MessageExpectation

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec/sleeping_king_studios/matchers/active_model/have_errors/message_expectation.rb

Overview

Stores an expectation of receiving a specified error message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, expected = true, received = false) ⇒ MessageExpectation

Returns a new instance of MessageExpectation.

Parameters:

  • message (String)

    The message which is expected to be or has been received.

  • expected (Boolean) (defaults to: true)

    Whether the message is expected.

  • received (Boolean) (defaults to: false)

    Whether the message has been received.



12
13
14
# File 'lib/rspec/sleeping_king_studios/matchers/active_model/have_errors/message_expectation.rb', line 12

def initialize message, expected = true, received = false
  super message, expected, received
end

Instance Attribute Details

#expectedObject

Returns the value of attribute expected

Returns:

  • (Object)

    the current value of expected



7
8
9
# File 'lib/rspec/sleeping_king_studios/matchers/active_model/have_errors/message_expectation.rb', line 7

def expected
  @expected
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



7
8
9
# File 'lib/rspec/sleeping_king_studios/matchers/active_model/have_errors/message_expectation.rb', line 7

def message
  @message
end

#receivedObject

Returns the value of attribute received

Returns:

  • (Object)

    the current value of received



7
8
9
# File 'lib/rspec/sleeping_king_studios/matchers/active_model/have_errors/message_expectation.rb', line 7

def received
  @received
end