diff --git a/tests/fixtures/competency/factory-registration/SCENARIO.md b/tests/fixtures/competency/factory-registration/SCENARIO.md new file mode 100644 index 0000000..af3055d --- /dev/null +++ b/tests/fixtures/competency/factory-registration/SCENARIO.md @@ -0,0 +1,5 @@ +# Registration through a factory + +Question: Which handler actually implements checkout? + +Expected: follow the registry/factory binding to `LiveHandler`; do not claim `DeadHandler` participates merely because it has a compatible shape. diff --git a/tests/fixtures/competency/factory-registration/handlers.py b/tests/fixtures/competency/factory-registration/handlers.py new file mode 100644 index 0000000..42ffa1c --- /dev/null +++ b/tests/fixtures/competency/factory-registration/handlers.py @@ -0,0 +1,5 @@ +class LiveHandler: + def handle(self): return 'live' + +class DeadHandler: + def handle(self): return 'dead' diff --git a/tests/fixtures/competency/factory-registration/registry.py b/tests/fixtures/competency/factory-registration/registry.py new file mode 100644 index 0000000..1744a4f --- /dev/null +++ b/tests/fixtures/competency/factory-registration/registry.py @@ -0,0 +1,6 @@ +from handlers import LiveHandler + +HANDLERS = {'checkout': LiveHandler} + +def build(name): + return HANDLERS[name]()