Mercurial > zeropaste
annotate test/controllers/pastes_controller_test.rb @ 344:49ae9d1f4f2c
Use coffeescript.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 03 Jul 2014 14:50:18 +0900 |
parents | 325fcf388442 |
children | 9fc6b919369c |
rev | line source |
---|---|
298 | 1 require "test_helper" |
2 | |
3 class PastesControllerTest < ActionController::TestCase | |
314 | 4 test "creates paste from plaintext" do |
5 assert_difference("Paste.count", 1) do | |
6 post :create, "paste" => { "paste" => "here be paste" } | |
7 end | |
8 | |
9 assert_response :redirect | |
10 end | |
11 | |
12 test "creates paste from gzip" do | |
13 assert_difference("Paste.count", 1) do | |
14 post :create, "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") } | |
15 end | |
16 | |
17 assert_response :redirect | |
18 end | |
19 | |
315
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
20 test "creates paste from base64 gzip" do |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
21 assert_difference("Paste.count", 1) do |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
22 post :create, "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) } |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
23 end |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
24 |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
25 assert_response :redirect |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
26 end |
325fcf388442
Another test for paste creation.
edogawaconan <me@myconan.net>
parents:
314
diff
changeset
|
27 |
298 | 28 test "filters spam" do |
29 assert_no_difference("Paste.count") do | |
30 post :create, "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } | |
31 end | |
32 | |
33 assert_response :success | |
34 end | |
35 end |