Skip to content

Example restructure

Mike Miller requested to merge example-restructure into release/0.9

Extensive overhaul to the way tests (examples) and groups are represented in code and their construction. A lot of code has been cleaned up and restructured.

Each context/group is its own class and the test is a method inside that class. This reduces the number of compiled types, which should decrease compilation time. Additionally, there are no longer concrete example classes created for each test.

Construction of the tests have been cleaned up. Hooks and test values (previously sample values) are passed around more effectively. This resolves issues that may arisen when implementing #6 (closed). Fixes using test values inside a nested sample block.

let and let! match their RSpec equivalents. The behavior of let! has changed from Spectator v0.8. Replicating its old behavior can be achieved by using a plain def (helper method).

Other changes:

  • Groups store their source (file and line number) and can be used for filtering.
  • Hooks (before-each and after-each) can be passed the running example as a block argument.

Specs have been removed, since it would be a big hassle to update them. Will re-add the specs with #15.

Edited by Mike Miller

Merge request reports