Skip to content

Scenario Start/End callbacks not fired in subcontexts #74

@mgwidmann

Description

@mgwidmann

Something like the following does not work:

defmodule GlobalContext do
  use WhiteBread.Context

  scenario_starting_state fn state ->
    Application.ensure_all_started(:hound)
    Hound.start_session
    state
  end

  scenario_finalize fn _state ->
    Hound.end_session
  end

  # Global given/then/and/ect you want to share with all contexts
end

defmodule MyContext do
  use WhiteBread.Context

  subcontext GlobalContext
end

It looks like here that steps are respected:
https://github.com/meadsteve/white-bread/blob/master/lib/white_bread/context/setup.ex#L9

But below the scenario start/end events are not (or maybe I'm wrong).

Either way I can't get the code in those events to start hound without coping and pasting it into each file. Also since the contexts are loaded first it seems, I can't do a use HoundSetup either...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions