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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
298
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
1 require "test_helper"
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
2
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
3 class PastesControllerTest < ActionController::TestCase
314
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
4 test "creates paste from plaintext" do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
5 assert_difference("Paste.count", 1) do
435
1d113463d154 Fix test deprecations
nanaya <me@myconan.net>
parents: 428
diff changeset
6 post :create, :params => { "paste" => { "paste" => "here be paste" } }
314
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
7 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
8
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
9 assert_response :redirect
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
10 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
11
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
12 test "creates paste from gzip" do
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
13 assert_difference("Paste.count", 1) do
435
1d113463d154 Fix test deprecations
nanaya <me@myconan.net>
parents: 428
diff changeset
14 post :create, :params => { "paste" => { "paste_gzip" => ActiveSupport::Gzip.compress("here be paste") } }
314
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
15 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
16
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
17 assert_response :redirect
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
18 end
3c22d4acc2fa Add basic controller test.
edogawaconan <me@myconan.net>
parents: 298
diff changeset
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
1d113463d154 Fix test deprecations
nanaya <me@myconan.net>
parents: 428
diff changeset
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
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
28 test "filters spam" do
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
29 assert_no_difference("Paste.count") do
435
1d113463d154 Fix test deprecations
nanaya <me@myconan.net>
parents: 428
diff changeset
30 post :create, :params => { "url1" => "http://hello.com", "paste" => { "paste" => "here be paste", "key" => "12341234" } }
298
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
31 end
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
32
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
33 assert_response :success
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
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
1d113463d154 Fix test deprecations
nanaya <me@myconan.net>
parents: 428
diff changeset
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
ff27821f9272 A test! Can you imagine that?!
edogawaconan <me@myconan.net>
parents:
diff changeset
41 end