Mercurial > zeropaste
annotate test/controllers/pastes_controller_test.rb @ 501:e62e57101e4a
Remove outdated test script
author | nanaya <me@nanaya.net> |
---|---|
date | Mon, 16 Dec 2024 01:11:30 +0900 |
parents | d2ef59c9a4b4 |
children |
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 | |
499 | 6 post :create, params: { "paste" => { "paste" => "here be paste" } } |
314 | 7 end |
8 | |
9 assert_response :redirect | |
10 end | |
11 | |
12 test "creates paste from gzip" do | |
13 assert_difference("Paste.count", 1) do | |
499 | 14 post :create, params: { "paste" => { "paste_gzip" => fixture_file_upload("hello_world.txt.gz") } } |
314 | 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 |
499 | 22 post :create, params: { "paste" => { "paste_gzip_base64" => Base64.encode64(ActiveSupport::Gzip.compress("here be paste")) } } |
315
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 | |
499 | 30 post :create, params: { "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } } |
298 | 31 end |
32 | |
33 assert_response :success | |
34 end | |
428
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
35 |
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
36 test "shows paste" do |
499 | 37 get :show, params: { id: pastes(:basic).id } |
428
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
38 |
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
39 assert_response :success |
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
40 end |
298 | 41 end |