Mercurial > zeropaste
annotate test/controllers/pastes_controller_test.rb @ 428:9fc6b919369c
Whoops, broken the very basic thing
Added test.
author | nanaya <me@myconan.net> |
---|---|
date | Sun, 15 Nov 2015 15:10:01 +0900 |
parents | 325fcf388442 |
children | 1d113463d154 |
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 | |
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 |
9fc6b919369c
Whoops, broken the very basic thing
nanaya <me@myconan.net>
parents:
315
diff
changeset
|
37 get :show, :id => pastes(:basic).id |
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 |