Contents

Clean context per example

In order to help isolate tests As a developer I want the execution context to be clean for every example

Scenario: Context is not tainted by previous examples

@php5.4

  • Given a file named "context.feature" with:
    php
    <?php
    describe("top level", function() {
    
        it("should pass", function() {
            $this->obj = new stdClass;
        });
    
        it("should also pass", function() {
            if (isset($this->obj)) {
                fail();
            }
        });
    });
  • When I run `dspec context.feature`
  • Then the output should contain "2 examples passed"

Source: features/execution_scope/clean_context_per_example.feature at commit cf8c810b, Dspec (MIT license).