@@ -14,34 +14,33 @@ defmodule Membrane.Testing.Pipeline do
1414 pass that options list to the `Membrane.Testing.Pipeline.start_link_supervised!/1`.
1515 The testing pipeline can be started in one of two modes - either with its `:default` behaviour, or by
1616 injecting a custom module behaviour. The usage of a `:default` pipeline implementation is presented below:
17-
1817 ```
19- links = [
20- child(:el1, MembraneElement1) |>
21- child(:el2, MembraneElement2)
18+ spec = [
19+ child(:el1, MembraneElement1)
20+ |> child(:el2, MembraneElement2)
2221 ...
2322 ]
23+
2424 options = [
2525 module: :default # :default is the default value for this parameter, so you do not need to pass it here
26- spec: links
26+ spec: spec
2727 ]
28+
2829 pipeline = Membrane.Testing.Pipeline.start_link_supervised!(options)
2930 ```
30-
3131 You can also pass your custom pipeline's module as a `:module` option of
3232 the options list. Every callback of the module
3333 will be executed before the callbacks of Testing.Pipeline.
3434 Passed module has to return a proper spec. There should be no children
3535 nor links specified in options passed to test pipeline as that would
3636 result in a failure.
37-
3837 ```
3938 options = [
4039 module: Your.Module
4140 ]
41+
4242 pipeline = Membrane.Testing.Pipeline.start_link_supervised!(options)
4343 ```
44-
4544 See `t:Membrane.Testing.Pipeline.options/0` for available options.
4645
4746 ## Assertions
@@ -57,15 +56,17 @@ defmodule Membrane.Testing.Pipeline do
5756 ## Example usage
5857
5958 Firstly, we can start the pipeline providing its options as a keyword list:
59+ ```
60+ import Membrane.ChildrenSpec
6061
61- import Membrane.ChildrenSpec
62- children = [
63- child(source, %Membrane.Testing.Source{} ) |>
64- child(:tested_element, TestedElement) |>
65- child(sink, %Membrane.Testing.Sink{})
66- ]
67- {:ok, pipeline} = Membrane.Testing.Pipeline.start_link(spec: links)
62+ spec = [
63+ child(:source, %Membrane.Testing.Source{output: [1, 2, 3]})
64+ |> child(:tested_element, TestedElement)
65+ |> child(:sink, Membrane.Testing.Sink)
66+ ]
6867
68+ {:ok, pipeline} = Membrane.Testing.Pipeline.start_link(spec: spec)
69+ ```
6970 We can now wait till the end of the stream reaches the sink element (don't forget
7071 to import `Membrane.Testing.Assertions`):
7172
0 commit comments