Class: Riot::EmptyMacro
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::EmptyMacro
- Defined in:
- lib/riot/assertion_macros/empty.rb
Overview
In the postive case, asserts the result of the test is empty.
asserts("a string") { "" }.empty
asserts("an array") { [] }.empty
asserts("a hash") { Hash.new }.empty
In the negative case, asserts the result of the test is not empty.
denies("a string") { "foo" }.empty
denies("an array") { [1] }.empty
denies("a hash") { {:foo => "bar" } }.empty
Instance Attribute Summary
Attributes inherited from AssertionMacro
Instance Method Summary collapse
-
#devaluate(actual) ⇒ Array
Supports negative/converse assertion testing.
-
#evaluate(actual) ⇒ Array
Supports positive assertion testing.
Methods inherited from AssertionMacro
#error, #expected_message, expects_exception!, #expects_exception?, #fail, #new_message, #pass, register, #should_have_message
Instance Method Details
#devaluate(actual) ⇒ Array
Supports negative/converse assertion testing. This is also where magic happens.
22 23 24 |
# File 'lib/riot/assertion_macros/empty.rb', line 22 def devaluate(actual) actual.empty? ? fail((actual).to_not_be_empty) : pass(.is_empty) end |
#evaluate(actual) ⇒ Array
Supports positive assertion testing. This is where magic happens.
17 18 19 |
# File 'lib/riot/assertion_macros/empty.rb', line 17 def evaluate(actual) actual.empty? ? pass(.is_empty) : fail((actual).to_be_empty) end |