Exception: AssertType::AssertionError

Inherits:
Error
  • Object
show all
Defined in:
lib/assert_type/assertion_error.rb

Direct Known Subclasses

TypeAssertionError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected, actual) ⇒ AssertionError

Returns a new instance of AssertionError.



8
9
10
11
# File 'lib/assert_type/assertion_error.rb', line 8

def initialize expected, actual
  @expected = expected
  @actual = actual
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



6
7
8
# File 'lib/assert_type/assertion_error.rb', line 6

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



6
7
8
# File 'lib/assert_type/assertion_error.rb', line 6

def expected
  @expected
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/assert_type/assertion_error.rb', line 13

def message
  "assertion failed - expected #{@expected} but was #{@actual}"
end