Class: Catechism::Matchers::RaiseError
- Defined in:
- lib/catechism/matchers/raise_error.rb
Instance Attribute Summary collapse
-
#negated ⇒ Object
Returns the value of attribute negated.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
Instance Attribute Details
#negated ⇒ Object
Returns the value of attribute negated
2 3 4 |
# File 'lib/catechism/matchers/raise_error.rb', line 2 def negated @negated end |
#subject ⇒ Object
Returns the value of attribute subject
2 3 4 |
# File 'lib/catechism/matchers/raise_error.rb', line 2 def subject @subject end |
Instance Method Details
#failure_message ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/catechism/matchers/raise_error.rb', line 16 def if negated "Expected no error to be raised, but an error was raised" else "Expected error to be raised, but no error was raised" end end |
#raised? ⇒ Boolean
3 4 5 6 7 8 9 10 |
# File 'lib/catechism/matchers/raise_error.rb', line 3 def raised? begin subject.call rescue StandardError => e return true end false end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/catechism/matchers/raise_error.rb', line 12 def valid? raised? ^ negated end |