Skip to content

Instantly share code, notes, and snippets.

@deepal
Last active July 16, 2022 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepal/8ec5106d91c759a82db38c79f05e2238 to your computer and use it in GitHub Desktop.
Save deepal/8ec5106d91c759a82db38c79f05e2238 to your computer and use it in GitHub Desktop.
describe("check_env module", function ()
local check_env = require "lib.check_env"
before_each(function()
stub(os, "getenv")
end)
after_each(function ()
os.getenv:revert()
end)
it("should return true if RUN_SUM env variable is set to '1'", function ()
os.getenv.on_call_with("RUN_SUM").returns("1")
assert.True(check_env())
end)
it("should return false if RUN_SUM env variable is not set", function ()
os.getenv.on_call_with("RUN_SUM").returns(nil)
assert.False(check_env())
end)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment