Sha256: 3fbf09d5df94d62ae1e55a77f67b23d2a21a161626751bae05612a95fffe2d68
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 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: 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 descriptions. Since the helper script was loaded three paragraphs back, the 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qed-2.2.2 | demo/03_helpers.rdoc |
qed-2.2.1 | demo/03_helpers.rdoc |
qed-2.2.0 | demo/03_helpers.rdoc |