41 lines
985 B
Lua
41 lines
985 B
Lua
_G.spy = spy
|
|
local mock_env = require("spec.env_mock")
|
|
local fuzzy = require("spec.fuzzgen")
|
|
|
|
describe("smr",function()
|
|
setup(mock_env.setup)
|
|
teardown(mock_env.teardown)
|
|
it("should display an anonymously submitted post on the front page", function()
|
|
local paste_post = require("endpoints.paste_post")
|
|
local index_get = require("endpoints.index_get")
|
|
local pages = require("pages")
|
|
local config = require("config")
|
|
config.domain = "test.host"
|
|
pages_mock = mock(pages)
|
|
configure()
|
|
assert.stub(pages_mock.index).was_not_called()
|
|
local post_req = {
|
|
host = "test.host",
|
|
method = "POST",
|
|
path = "/_paste",
|
|
args = {
|
|
title = fuzzy.any(),
|
|
text = fuzzy.any(),
|
|
pasteas = "anonymous",
|
|
markup = "plain",
|
|
tags = "one;two;",
|
|
}
|
|
}
|
|
paste_post(post_req)
|
|
local get_req = {
|
|
host = "test.host",
|
|
method = "GET",
|
|
path = "/",
|
|
args = {},
|
|
}
|
|
index_get(get_req)
|
|
assert.stub(pages_mock.index).was_called()
|
|
pending("TODO")
|
|
end)
|
|
end)
|