Module: ApprovalTests::Extensions::RSpec
- Defined in:
- lib/approval_tests/extensions/rspec.rb
Instance Method Summary collapse
- #approve(thing = nil, options = {}, backtrace = nil, &implementation) ⇒ Object
- #approve_html(thing = nil, options = {}, backtrace = nil, &implementation) ⇒ Object
Instance Method Details
#approve(thing = nil, options = {}, backtrace = nil, &implementation) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/approval_tests/extensions/rspec.rb', line 6 def approve(thing=nil, ={}, backtrace=nil, &implementation) if block_given? approve_description = "#{thing}" else approve_description = nil result = thing end example(approve_description, ) do if block_given? result = yield implementation end Approvals.approve(result) end end |
#approve_html(thing = nil, options = {}, backtrace = nil, &implementation) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/approval_tests/extensions/rspec.rb', line 22 def approve_html(thing=nil, ={}, backtrace=nil, &implementation) if block_given? approve_description = "#{thing}" else approve_description = nil result = thing end example(approve_description, ) do if block_given? result = yield implementation end Approvals.approve(result, :html) end end |