-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new submissions app spec file, add delete specs
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import use_test_server from require "lapis.spec" | ||
import truncate_tables from require "lapis.spec.db" | ||
|
||
import request, request_as from require "spec.helpers" | ||
|
||
factory = require "spec.factory" | ||
|
||
import Users, Submissions, SubmissionLikes, SubmissionTags from require "models" | ||
|
||
describe "applications.submission", -> | ||
use_test_server! | ||
|
||
local submission | ||
|
||
before_each -> | ||
truncate_tables Users, Submissions, SubmissionLikes, SubmissionTags | ||
submission = factory.Submissions! | ||
|
||
it "renders delete submission page", -> | ||
status = request_as submission\get_user!, "/submission/#{submission.id}/delete" | ||
assert.same 200, status | ||
|
||
it "deletes the submission", -> | ||
status, _, headers = request_as submission\get_user!, | ||
"/submission/#{submission.id}/delete", { | ||
post: { | ||
action: "delete" | ||
} | ||
} | ||
|
||
assert.same 302, status | ||
assert.nil Submissions\find submission.id | ||
|