modglobal v0.2.4 Modglobal.Mock View Source
A test helper used to mock Modglobal for your tests
Link to this section Summary
Functions
Same as setup/2 except it doesn’t validate the arguments passed in
Sets up the ServerMock with the calls it should expect
Link to this section Functions
Same as setup/2 except it doesn’t validate the arguments passed in.
Examples
Modglobal.Mock.setup([
{:set, nil},
{:get, "Ada"},
])
This would allow the real code to call Modglobal.set_global(:name, "Ada")
, followed by
Modglobal.get_global(:name)
, returning nil
for the first call, and “Ada” for the second call.
However, it would also allow Modglobal.Mock.set(:naame, "Ada")
because the arguments aren’t checked
Sets up the ServerMock with the calls it should expect
Returns :ok
Examples
Modglobal.Mock.setup(MyModule, [
{:set, [key: :name, value: "Ada"], nil},
{:get, [key: :name, default: nil], "Ada"},
])
This would allow the real code to call Modglobal.set_global(:name, "Ada")
, followed by
Modglobal.get_global(:name)
, returning nil
for the first call, and “Ada” for the second call