Skip to content

Commit

Permalink
new submissions app spec file, add delete specs
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Jul 15, 2015
1 parent b8f4ba0 commit 0630c36
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/applications/submission_spec.moon
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

0 comments on commit 0630c36

Please sign in to comment.