Sha256: 25d96225e182e6857da432f7d6c39c07f4ec4db5a196e8867904a9fa9930faae

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

= Fixtures

== Flat-file Data

When creating testable demonstrations, there are times when sizable
chunks of data are needed. It is convenient to store such data in
separate files. The +Data+ method makes is easy to load such files.

    Data('demo/fixtures/data.txt').assert =~ /dolor/

All files are found relative to the location of current document.

== Tabular Data

The +Table+ method is similar to the +Data+ method except that it
expects a YAML file, and it can take a block to iterate the data over.
This makes it easy to test tables of examples.

The arity of the table block corresponds to the number of columns in
each row of the table. Each row is assigned in turn and run through
the coded step. Consider the following example:

Every row in the {table.yml table}[table.yml] will be assigned to
the block parameters and run through the subsequent assertion.

    Table 'demo/fixtures/table.yml' do |x, y|
      x.upcase.assert == y
    end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qed-2.2.1 demo/04_fixtures.rdoc
qed-2.2.0 demo/04_fixtures.rdoc