Sha256: bfbdcb55ecbff2f5af8f2d2fb0f80b8fff1fa35ad3cfa7c03e336f5e5848d898
Contents?: true
Size: 1.42 KB
Versions: 7
Compression:
Stored size: 1.42 KB
Contents
= Helpers There are two ways to load advice scripts. Either per demonstration or globally. Per demonstration helpers apply only to the current demonstration. Global helpers apply to all demonstrations. == Global Helpers Global helpers are loaded at the start of a session and apply equally to all demonstrations in a suite. Global helpers are simply Ruby scripts and are placed in an +environment+ subdirectory. For instance this document is used <a href="environment/env.rb">environment/env.rb</a>. == Local Helpers Helper scripts can be written just like demonstration scripts, or they can be defined as pure Ruby scripts. Either way they are loaded per-demonstration by using specially marked links. For example, because this link, Advice[qed://helpers/advice.rb], begins with +qed:+, it will be used to load a global helper. We can see this with the following assertion. pudding.assert.include?('load advice.rb') No where in the demonstration have we defined +pudding+, but it has been defined for us in the advice.rb helper script. We can also see that the generic When clause in our advice helper is keeping count of decriptive paragraphs. Since the helper script was loaded two paragraphs back, the next count will be 3. count.assert == 3 Helpers are vital to building test-demonstration suites for applications. But here again, only use them as necessary. The more helpers you use the more difficult your demos will be to follow.
Version data entries
7 entries across 7 versions & 1 rubygems