Mercurial > zeropaste
annotate test/controllers/pastes_controller_test.rb @ 465:f109a8aacad5
Update gems
author | nanaya <me@nanaya.pro> |
---|---|
date | Fri, 31 May 2019 09:10:28 +0900 |
parents | 1d113463d154 |
children | 84ca55a0568e |
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 | |
435 | 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 | |
435 | 14 post :create, :params => { "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") } } |
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 |
435 | 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 | |
435 | 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 |
435 | 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 |