Exception: UnexpectedInput

Inherits:
StandardError
  • Object
show all
Defined in:
lib/expects/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject = nil, expected = nil) ⇒ UnexpectedInput

Returns a new instance of UnexpectedInput.



4
5
6
# File 'lib/expects/error.rb', line 4

def initialize(subject = nil, expected = nil)
  @subject, @expected = subject, expected
end

Instance Attribute Details

#expectedObject (readonly)

Returns the value of attribute expected.



2
3
4
# File 'lib/expects/error.rb', line 2

def expected
  @expected
end

#subjectObject (readonly)

Returns the value of attribute subject.



2
3
4
# File 'lib/expects/error.rb', line 2

def subject
  @subject
end

Instance Method Details

#build_messageObject



12
13
14
# File 'lib/expects/error.rb', line 12

def build_message
  "Expected #{@subject.inspect} to be #{expected.join(", ")}"
end

#messageObject



8
9
10
# File 'lib/expects/error.rb', line 8

def message
  @message ||= build_message
end