Module: Funktional::AttributeTestHelper
- Defined in:
- lib/funktional/attribute_test_helper.rb
Instance Method Summary collapse
- #add_attrib(addition) ⇒ Object
- #blank_attrib(to_blank) ⇒ Object
- #missing_attrib(to_remove) ⇒ Object
- #replace_attrib(to_replace) ⇒ Object
Instance Method Details
#add_attrib(addition) ⇒ Object
23 24 25 |
# File 'lib/funktional/attribute_test_helper.rb', line 23 def add_attrib(addition) attrib.merge(addition) end |
#blank_attrib(to_blank) ⇒ Object
12 13 14 |
# File 'lib/funktional/attribute_test_helper.rb', line 12 def blank_attrib(to_blank) attrib.merge(to_blank => '') end |
#missing_attrib(to_remove) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/funktional/attribute_test_helper.rb', line 4 def missing_attrib(to_remove) copy_of_attrib = attrib.clone found = copy_of_attrib.delete to_remove raise Exception, 'attribute marked for removal is missing' unless found return copy_of_attrib end |
#replace_attrib(to_replace) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/funktional/attribute_test_helper.rb', line 16 def replace_attrib(to_replace) key = to_replace.keys.first value = to_replace.values.first attrib.merge(key => value) end |