Sha256: fc1e0edd8d137933a0c6af875743bc07a7b80b5761396a83c9a51a2b01b27e03

Contents?: true

Size: 821 Bytes

Versions: 7

Compression:

Stored size: 821 Bytes

Contents

= Assertion Counts

AE tracks the number of assertions made and the number that failed to pass.
We can reset the count using the +recount+ class method.

  old_counts = AE::Assertor.recount

For example if we have one assertion pass and another fail.

  assert(true)

  expect Assertion do
    assert(false)
  end

We will see that AE counted three assertions and one failure.

  counts = AE::Assertor.counts.dup

  counts[:total].assert == 3
  counts[:pass].assert  == 2
  counts[:fail].assert  == 1

The #expect call is an assertion too, which is why the total count is 3
rather than 2.

Now that we are done checking counts we will restore them so that
any other demos being run with this will tally correctly.

  AE::Assertor.recount(old_counts)
  AE::Assertor.counts[:total] += 3
  AE::Assertor.counts[:pass]  += 3

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ae-1.8.1 qed/06_counts.rdoc
ae-1.8.0 qed/06_counts.rdoc
ae-1.7.4 qed/06_counts.rdoc
ae-1.7.3 qed/06_counts.rdoc
ae-1.7.2 qed/06_counts.rdoc
ae-1.7.1 qed/06_counts.rdoc
ae-1.7.0 qed/06_counts.rdoc