Module: Defekt::Assertions
- Included in:
- Base
- Defined in:
- lib/defekt/assertions.rb
Instance Method Summary collapse
- #equal_to!(expected, actual) ⇒ Object
- #identical_to!(expected, actual) ⇒ Object
- #included_in!(collection, member) ⇒ Object
- #instance_of!(klass, instance) ⇒ Object
- #kind_of!(klass, instance) ⇒ Object
- #true!(value) ⇒ Object
Instance Method Details
#equal_to!(expected, actual) ⇒ Object
9 10 11 12 13 |
# File 'lib/defekt/assertions.rb', line 9 def equal_to!(expected, actual) unless actual == expected raise Errors::EqualToError, (actual, 'is not equal to', expected) end end |
#identical_to!(expected, actual) ⇒ Object
15 16 17 18 19 |
# File 'lib/defekt/assertions.rb', line 15 def identical_to!(expected, actual) unless actual.equal?(expected) raise Errors::IdenticalToError, (actual, 'is not identical to', expected) end end |
#included_in!(collection, member) ⇒ Object
21 22 23 24 25 |
# File 'lib/defekt/assertions.rb', line 21 def included_in!(collection, member) unless collection.include?(member) raise Errors::IncludedInError, (member, 'is not included in', collection) end end |
#instance_of!(klass, instance) ⇒ Object
27 28 29 30 31 |
# File 'lib/defekt/assertions.rb', line 27 def instance_of!(klass, instance) unless instance.instance_of?(klass) raise Errors::InstanceOfError, (instance, 'is not an instance of', klass) end end |
#kind_of!(klass, instance) ⇒ Object
33 34 35 36 37 |
# File 'lib/defekt/assertions.rb', line 33 def kind_of!(klass, instance) unless instance.kind_of?(klass) raise Errors::KindOfError, (instance, 'is not a kind of', klass) end end |
#true!(value) ⇒ Object
3 4 5 6 7 |
# File 'lib/defekt/assertions.rb', line 3 def true!(value) unless value raise Errors::TrueError, (value, 'is not', true) end end |